Make a question required conditionally based on answer to previous question

Jump to solution
03-30-2017 08:07 AM
Occasional Contributor III

I asked this a while back to no avail and question came up again so I thought I'd try give it another try.

I'd like to make a question conditionally required, that is I would always like it to visible however if a previous question is answered a certain way I would like the question to be required. Does any one know if this is possible?

Here is a link to my original question: Survey 123 Conditionally Required Question

24 Replies
Occasional Contributor II

Has there been any progress for allowing this functionality in the Web form?

Chris Anderson

Florida Fish and Wildlife Conservation Commission

0 Kudos
Esri Notable Contributor

Hi. Yes. This has been implemented. Make sure you use Survey123 Connect version 3.11 or newer for this. This works in both the Survey123 field and web apps.

Attaching an XLSForm illustrating how this can be done.

select_one yes_nonextrequiredMake next question required?
New Contributor

Hi there,

I know this was from a while ago, but I was wondering if the ability to put a function in the required section has changed at all. I'm trying to do so, but it is only letting me pick yes or leave blank. I am on version 3.15.170 and I am just trying to make it so that the question isn't 'completed' until the value is = 100. Cheers!

0 Kudos
Occasional Contributor


i have used this if statement in the required field: if (${Type_Suivi}='Elimination','yes',''), where Type_Suivi is a select_one question. I also have conditions in the relevant column for that same question. I am not getting a required question when using the form. The only way I can have this question required is when i remove the if statement and the relevant expression. Any clues?

0 Kudos
MVP Esteemed Contributor

The statement must evaluate to True not 'yes'.  You can pull this off using 1 and 0.

Use this 

if (${Type_Suivi}='Elimination',1,0)

0 Kudos
Occasional Contributor

Thanks Doug! Just had it working also using: ${Type_Suivi}='Elimination'

0 Kudos
MVP Esteemed Contributor

Opps I was writing Ifs all day so I forgot.  Same though - evaluate to true.

How I use if in relevant is things like if(${state}="WA",${Type_Suivi}='Elimination',0).  This is having a relevant only for certain situations.

Sorry about that

0 Kudos
New Contributor III

I really need the conditionally relevant feature, so definitely bump this up on your enhancement priorities.

New Contributor III

Without knowing what workflows you're using, this method is one that I've tried with some success:

  1. Take the question you want to be conditionally required and make a second copy of it.
  2. One copy is marked as required, the other isn't.
  3. Each copy has a relevant condition such that only one copy will display. In the case of the required copy, this will be the condition you have in mind that makes this question required.
  4. Set both copies as null
  5. Have a read-only or hidden question populate with the answer of the above two copies, using an if/then statement based on your original requirement condition. This keeps both of the above copies' answers in the same field.

select_one yes_noIsRequiredShould this question be required?
textNotRequiredThis question is not required.${IsRequired}='no'
textRequiredThis question is required.*${isRequired}='yes'
textResultThis field stores the values of 'Required' and 'NotRequired'if(selected(${IsRequired}, 'yes'), ${Required}, ${NotRequired})
Occasional Contributor III

Great work around Nick!!! Thanks for sharing, this will be a regular part of the workflow in many forms.

0 Kudos