How To Add Validation Rules

Overview

SurveyToGo fully supports scripting and usage of validation rules.
From the simplest ones, to the most complicated.


A Validation rule is a script that is added to a question and will be checked each time the question is being advanced forward.
If the script is valid, it will proceed to checking the jump rule (if there is one), and continue to the next question.
If it is not valid, it would prompt a custom message, and will not allow continuing.

Step 1: Add a new instance of a validation rule.

Step 2: Configuring The validation rule’s condition.

Step 3: Configuring the Validation Rule’s Custom Message.

Adding a new instance of a validation rule.

In order to add a validation rule to a question, you should go to the questions ‘Rules’ tab.
Then, you should click the button for creating a new instance of a validation rule:

Configuring The validation rule’s condition

Now let’s add the condition:

Let’s say, for this example that the current question asks about:
“How many of your kids like chocolate?”

And that question number 2 asks:
“How many kids do you have?”

So this validation rule basically checks if the answer of the current question is greater than the answer of question 2, which is not reasonable – as if a person says he has 3 kids, but he answers that 5 of his kids like chocolate, it does not make sense.
Therefore the validation rule comes in hand.

Configuring the Validation Rule’s Custom Message.

Now, let’s add an error message to prompt:

This message will prompt if the answer would be greater than the answer of question 2 and will not allow continuing, as the validation rule says.

Important Note: When adding a validation rule in an expression question do not use Answer(CurrQues) as the answer value is not yet available at the stage when the rule is executed due to the order of actions within an expression question execution.

Please note: you can also pipe answers into the validation rule, click here to learn more 

That’s it!

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.