select_multiple : Prevent unselecting once first selection is made

439
3
05-09-2019 05:10 PM
AlainChouinard
New Contributor III

I have a survey in which the user must first select the sections that need to be completed. I used a select_multiple question as the first question so that the user could choose which sections to fill. Then each section consists of a group where the begin_group question is relevant to whether the corresponding choice is made in the first question, using the selected() command. However, if the user unselects a choice in the first question, the corresponding group goes off and the answers are lost. So I would like to prevent the user from unselecting a choice once he has selected it. Is there a way to make the first question readonly once the choice is made? Or another possible solution?

Thanks to all !

0 Kudos
3 Replies
Philip-Wilson
Esri Notable Contributor

Hi Alain,

Have you tried using an expression in the read only column, so that once there is a value it becomes read only? I am not sure if this will work on a select multiple if you apply the expression on the same question you are currently adding values to (may not even be possible or make logical sense), but otherwise you could use additional questions that follow that once answered set the previous question to be read only based on its read only expression. I could think of a few ways to try and achieve this.

Could you share your xlsx file, that may help us understand the layout of your questions and groups and ways that we could make this work with additional expressions and questions.

Phil.

0 Kudos
DougBrowning
MVP Notable Contributor

How about create a second field that is hidden.  Use a calculate on this field then base the relevant off this second field.

Use once but You may need to add a if

so once(${Field1})

or

if(${Field1} != '', once(${Field1}),'')

0 Kudos
AlainChouinard
New Contributor III

Thanks Philip and Doug !

See attached my simplified survey TestUnselectIf.xlsx (it is in French but I think you can understand the scope). I think my workaround looks like what you are suggesting. I added a field (inf_Confirmer) asking the user to confirm the choice made in the first question (inf_Taches). If the choice 'Confirmer' is selected in this second question (this is the only possible choice), then the first question (inf_Taches) becomes read-only with the formula if(selected(${inf_Confirmer},'1'),'yes',''). In addition, as long as the confirmation is not given by the user to the second question (inf_Confirmer), all groups corresponding to each selected section remain read-only, by the formula if(selected(${inf_Confirmer},'1'),'','yes') applied to each group, preventing the user from entering data as long as there is a danger of accidentally deleting the groups.

With this solution there is still a small danger that the user uncheck the 'Confirmer' choice and then the first question becomes editable again.

Doug, I wasn't aware of the 'once' function. I tried it instead of the 'if' function in the readonly column of the 'inf_Taches' field so that it would become read-only as soon as the 'inf_Confirmer' question is answered (see TestUnselectOnce.xlsx). In this case, the 'inf_Taches' question remains read-only forever. I think that it will be a good solution: indeed, if the user has not made the right choice and has already confirmed his choice, he can simply delete the survey since this is the first question to answer, he will not lose his work.

If you have any other solution let me know, but I think that these solutions are viable to our team.

Thanks again !

0 Kudos