Select to view content in your preferred language

Required questions not working

404
3
Jump to solution
06-02-2023 11:48 AM
AnnaScholl
Occasional Contributor

In the first page of my survey, I have some questions relating to consent. If the user does not consent, I don't want them to see the rest of the survey, so I have set those pages to hidden unless the first question is 'yes.'

Let's say:

Question 1:

yes / no

Question 2: 

Yes/no

Question 3:

City, Country

Question 4:

yes/no

If the user answers No to Q1, none of the following questions should be shown and survey is submitted immediately. 

But, if user selects yes to Q1 and no to Q2, I need 3 and 4 to become required and visible. However, they are required but they don't "stop" the survey from going forward, the user can still proceed. In the image below, it is possible to click the proceed arrow even though the question is required!!!!

LydiaYoungblood_0-1685731699870.png

Does anyone have any ideas? 

 

0 Kudos
1 Solution

Accepted Solutions
AnnaScholl
Occasional Contributor

It looks like I didn't need ifs afterall...

I used 
(${Q1}='yes' and ${Q2}='yes_') or (${Q!}='yes' and ${Q2}='no_' and ${Q4}='yes_gdpr').

Unfortunately Q3 was a text field which required that the user hit their enter key for the expression to be valid, so had to take that one out. 

View solution in original post

0 Kudos
3 Replies
Katie_Clark
MVP Regular Contributor

For the subsequent pages that are hidden until the first page is filled out completely, try a logic statement that covers every scenario.

Something like this (my own "pseudocode", not official syntax)...

[page is visible] IF (Q1 = 'Yes' AND Q2 = 'Yes') OR (Q1 = 'Yes' AND Q2 = 'No' AND Q3 != '' AND Q4 != '')

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
AnnaScholl
Occasional Contributor

Hi Katherine, 
Thanks for your answer. Do you have any resources on where to study how to form these statements? I have tried: 

if(${Q1}='Yes, I consent' and ${Q2}='Yes, I live in xyz') or if(${Q1}='Yes, I consent' and ${Q2}='No, I live somewhere else' and ${Q3} !='' and ${Q4} !='')

But I keep getting the error: "If statements require three arguments, 1 provided." The thing is, Q1, Q2, and Q4 are single select, so I understood the = sign was okay. Q3 is text. 

I understand from here that an if should be "if condition is met, return x if TRUE and y if FALSE." But what would be returned here? I just want the question to show up if the condition is met. 

Many thanks for this new user. 

0 Kudos
AnnaScholl
Occasional Contributor

It looks like I didn't need ifs afterall...

I used 
(${Q1}='yes' and ${Q2}='yes_') or (${Q!}='yes' and ${Q2}='no_' and ${Q4}='yes_gdpr').

Unfortunately Q3 was a text field which required that the user hit their enter key for the expression to be valid, so had to take that one out. 

0 Kudos