Conditional form dramas


(John) #1

Hi guys,

I would like to make a simple feedback form using out of the box Squiz goodness.

There are 3 questions,

  1. A field for the users feedback
  2. A YES/NO option list for “Please contact me with a response”.
  3. If YES is selected, the third question will show requesting an e-mail address. If NO is selected this question will not show.

The e-mail address is a required entry, but not if NO is selected.

Can anyone recommend the best way to do this? I would like to avoid JS so we can modify this in the future without bothering our busy web devs.

Thanks for your help!


(Bart Banda) #2

If you want to avoid JS you would have to make it a multi step form with the email field on the second page and conditionally show it using keyword modifiers based on the response to the previous question on step 1.

I would still recommend using JS as it wouldn’t require much to get it working that way and it would save you having to split the form into 2 pages.


(Phillip Booth) #3

Modify your requirements to validate the Email field to be filled in if yes to question 2.

Expected outcome:
If the user selects “Yes” and does not enter an Email, an Error Message appears.
If they Select “No” and no email entered the form will be submitted.

How to
Use a Select type question for "“Please contact me with a response” and add values to each Text (answer). Yes = 1 No = 2

Simple Validation Rules
Have the Email question set to Required Entry = Required.
Enter a message in “Custom Required Error” such as “You have not provided your email address”.
Then tick the box to add a condition to this validation rule.
Select the question 2 (asset ID).
Select the “is less than” option and enter number “2” minus quotation.

Hope this is a better alternative solution.

Adding Conditions to Simple and Complex Validation Rules


(John) #4

Thanks so much guys! I used both of your answers- conditions and a few lines of javascript to hide the textbox when not needed.