What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
How can I validate an answer based on the value of a previous question?Asked by Focha on March 20, 2017 at 06:43 PM
How can I validate an answer based on previous question?
How many hours do you spend watching TV?
How many of those hours do you spend watching sports channel?
Now you see, the numeric value of the 2nd answer cannot be greater than the 1st one.
How can I do that?
Thank you for your support.
Yes, it is possible to achieve it using conditions, to do it, you will need to use the number field and add some text just as alert to your user:
Once this is done, you need to add a condition to evaluate the fields and show the message based on user's answer, if the second question is greater than the first one then the text displays:
You need to use the number fields, otherwise the "Greater Than" statement will not be shown.
This guide will also provide you with more details about how to show/hide fields based on user's answers: https://www.jotform.com/help/316-How-to-Show-or-Hide-Fields-Base-on-User-s-Answer
Here's also a testing form where you can see how it works: https://form.jotformpro.com/70789053229968
Should you have any question, please let us know.
Ok, I understand the process, but that does not prevent the submitter to continue to the next page.
Is there any way of preventing that?
You could include the page break buttons in the conditions, submit button may be also included if you would want it too.
Then if the second field's value would be greater than the first one the page break buttons will be hidden and the message will be shown.
Here's the modified condition:
I've updated my sample form, you could take a look to the result here: https://form.jotformpro.com/70789053229968
Hope this helps.
Ok, now I understand! It seems truly a matter of logic.
Thank you and well done. I now understand a bit more of the system.