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.


  • Profile Image

    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

    Hi all,

    How can I validate an answer based on previous question?

    Example:

    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.

    Kind regards,

    Carlos

  • Profile Image
    JotForm Support

    Answered by Kevin_G on March 20, 2017 at 10:52 PM

    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. 

  • Profile Image

    Answered by Carlos on March 21, 2017 at 07:51 AM

    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?

    Kind regards.

  • Profile Image
    JotForm Support

    Answered by Kevin_G on March 21, 2017 at 10:32 AM

    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. 

  • Profile Image

    Answered by Carlos on March 22, 2017 at 10:58 AM

    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.

    Kind regards.