obligate choice

Hi prodigiers

I am trying to wrap my head around how to fit the choice recipe with my needs.

My scenario is as follows. Assume we have three labels (in rel.manual) and some extra context (using html block). For each relation I would want the user to answer a yes/no question (e.g. did relation X require the information from the broader context?).

The problem with a checkbox is in case the user didn't check it, so I can't know if it was because the answer is NO or because he decided to skip.
The problem with the single-mode (the one with radio -buttons instead of checkboxes), is that i would need multiple choice blocks ( because for each relation i want a different question with a different yes/no answers. - which afaik is not allowed.

Can the current solution be fixed? Can you think of any other solution/workaround?

Thanks a lot :slight_smile:

Hi! This definitely makes sense :+1: It sounds like a good solution could be to have an explicit option for "no" for each relation, and then use the the validate_answer callback to make sure that an option was selected for each relation: https://prodi.gy/docs/custom-recipes#validate_answer

This also gives you the most flexibility in terms of what you consider valid – for example, you can assert that the "accept": [] list includes one ID for each relation (either yes or no). If it doesn't, the user will see an an alert in the UI and won't be able to submit. If they want to skip (e.g. because something is unclear/confusing/wrong), they have to hit skip explicitly.

A very neat solution!
Worked like a charm :slight_smile:

Thanks a lot!

1 Like