I’m trying to use the structure field for a quiz backend where each question is an entry in a structure field. The structure field contains question, answer-options (tags field) and a select field for choosing which of these options that is the correct answer.
Can’t figure out how to query the answeroptions - if possible:
label: Quiz entry
label: Answer options
label: Correct answer
fetch: page.quizentry.toStructure.??? (can I dig into the structure here?)
Looked into this related question, but split doesn’t seem to help when it’s within the same structure field: Fetch tags as options from another tags field inside a blueprint
I don’t think this is possible. First, you want to select something that hasn’t even been stored yet, secondly, the structureItem selects a single field from all items in the structure, so selecting a field that itself contains an array wouldn’t be possible unless you use the API option for this. Then again, only once the content has been saved.
answeroptions field and inject them on the fly into the
Ah, ok - I misunderstood the page.field query, thought it was querying the DOM, so you could get values from the same page without saving.
When I have saved I do get something that seems to be in the right direction, though
But thanks for the tip, I’ll look into the field plugin.
Yes, but your result is not really what you need. While it should be possible to get the right values either through the API option or through a custom method, it wouldn’t make sense from a workflow perspective to first have to save and then revisit the field to select the correct answer.