If user selects "none" in multiple select, prevent selection of other options

Is there a way if i have a question with multiple answers and one of them is (none). Now is there a way if (none ) is chosen, the other choices can't be chosen. I do not want to use the constraints to just remind the person. I mean the one who chooses will not be able to put a mark on other choices

You can skip/hide such a question using relevant if it is satisfying you.

test.xls (42 KB)
What i meant is if you see in the excel test there is a satisfaction question. If the respondent chooses (not satisfied), then the first two choices will be unmarked automatically, so that the calculation will be correct. I mean the first question. Is there a formula for that and not a constraint because the constraint will just warn and so the calculation will not change.

It's not possible, you can, for example, skip next question if not satisfied option is selected or calculate a value depending on that option but not unselect other options automatically. Why do you use select_multiple there and not select_one?

test.xls (42 KB)
I think in this sheet it is clearer. I was just wondering if there is a way the respondent while selecting the available assets, he might select all of them and so the calculation will be incorrect. I mean he/she might select (tables, chairs and none) and the same time and the score will not be correct

It will be incorrect and that's why I asked why you use select_multiple
and another question is could you give a few examples of the expected result, I mean from your calculation.

test.xls (42.5 KB)
Here you find an example. What if the respondent chooses (none and tables and chairs). What i wanted to know if there is a formula to write to prevent him/her from selecting two contradictory things.

I can see two options:

  1. Use constraint to force correcting an answer
  2. Or you can treat such an answer as 0 every time none is selected (no matter it's only none or none + something else)

Hi and welcome, @Mosab_English! Please be sure to post a new topic if you have a new question. If you think a topic may be related, please link to it rather than responding to the topic.

A constraint is exactly what you want in this case. A user will not be able to save the form until a constraint is satisfied so although they could have an answer that is not valid initially, they will need to fix it before the form can be completed.

There are a few examples of constraints you can use in past forum questions including Creating contraints on select_multiple. For your example, that would be something like

if(selected(., '0'), count-selected(.)=1, count-selected(.)>=1)

I think count-selected(.)>=1 will effectively make the question mandatory - it has to have an answer. Might this be better?

if(selected(., '0'), count-selected(.)=1, true())

1 Like

That's correct. With a 'none' option blank should probably not be allowed. What's the difference between 'none' and blank?

1 Like

If the intention is that question must be answered (ie mandatory), I'd probably do that via required='true()' - which will then be appropriately displayed in the UI (eg prefixed with '*') - rather than obfuscating it via a constraint='...' :grin:


Would you help me in this issue.
in this test excel sheet the calculation of the assets is as following:
tables = 2
chairs = 1
none = 0

How would the formula in the calculation be if I changed the tables calculation to be = 1, which means that there will be two assets with the same calculation.
Is there a different formula that i have to use instead of the one i already used in the test sheet.test (5).xls (42.5 KB)
The calculation i am seeking is that if the respondent chooses 'chairs' the calculation will be '1' and the same for the tables and if 'none' is chosen the calculation will be '0'

You need just to edit calculation in row 3 changing 2 to 1.

1 Like

I would address this a different way (sort-of)
I would have multiple yes/no select_one questions.
But then I would use appearance = field_list or table_list to make all the queries appear on a single page.
This gives an overall experience more like select_multiple but makes it impossible for the user to select mutually exclusive answers.

1 Like

Note, you are still going to have to create the necessary constraint and/or relevancy tests between the (3) questions. I think Mosab's proposed select-multi - table, chairs, none - is fairly intuitive, it just needs the necessary (hidden) logic in the form to ensure it behaves correctly, all of which is nicely hidden from the end-user. :slight_smile:

So this:

constraint = "if(selected(., '0'), count-selected(.)=1, true())"

will enforce the required mutual exclusivity on the multi-select. And something like

calculate = "coalesce(selected-at(${x},0),0) + coalesce(selected-at(${x},1),0)"

should handle the desired total calculation (note, due none being mutually exclusive, at most you can have 2 selected things).

No you wouldn't - you wouldn't have a none option.
You would have multiple Yes/No choices
None would be == Clicking No on each choice
Chair Yes / No
Table Yes / No

None would not be an explicit option - but equivalent to selecting No both times.

This is

  1. Easy to programme with select_ones only
  2. Easy to lay out nicely with table list
  3. Doesn't require any complex constraints
    To me this is much easier and cleaner
1 Like

I think that the problem with this approach is that field-list appearance will not check the relevant of the yes/no question