Creating an error message when someone submits two values that are the same

  • mreade
    Asked on February 3, 2017 at 6:41 PM

    https://form.jotformeu.com/70316679059363

    Hello

    I need to enforce some eligability criterial for a small grants scheme.  Applicants must be based in different faculties.

    Therefore if the faculty selected in the drop down list in Faculty #_input91 is the same as #_input239 can Jotform produce a message reminding applicants that they must be based in different faculties?

    Thanks for your help.

    Michael  Reade

  • liyam
    Replied on February 4, 2017 at 1:08 AM

    Hello Michael,

    Unfortunately, there is currently no direct method for getting two fields for comparison for validation. So you will need to create conditions for comparison for each value which can be selected for two fields. Here's an example of what I mean:

    Creating an error message when someone submits two values that are the same Image 1 Screenshot 20

    So you will need to have one item for each as your condition.

    Alternatively, you can get your form's full HTML source and place it on your own web page. Then you can insert javascript codes in it for validation. You can check this guide for more information: https://www.jotform.com/help/104-How-to-get-the-Full-Source-Code-of-your-Form

    If you have questions, please let us know.

    Thanks.

     

  • Chriistian Jotform Support
    Replied on February 4, 2017 at 1:18 AM

    Another workaround you can try to implement the validation is to pass the value of the drop down field in Form Calculation and use the conditions to show/hide error message. Here is a sample cloned form that I used for testing: https://form.jotform.com/70340441809956.

    Creating an error message when someone submits two values that are the same Image 1 Screenshot 80

    Creating an error message when someone submits two values that are the same Image 2 Screenshot 91

     

    Here is a step by step guide to implement the checking.

    1. Add Text field in your form for the Error Message.

    Creating an error message when someone submits two values that are the same Image 3 Screenshot 102

    2. Add two form calculation field that will capture the selected value for each Faculty field.

    Creating an error message when someone submits two values that are the same Image 4 Screenshot 113

    Faculty 1 calculation Value:

    Creating an error message when someone submits two values that are the same Image 5 Screenshot 124

    Faculty 2 calculation Value:

    Creating an error message when someone submits two values that are the same Image 6 Screenshot 135

    3. Setup Condition to show error message and also hide the submit button so user will not be able to submit the form.

    Creating an error message when someone submits two values that are the same Image 7 Screenshot 146

     

    You can also clone the sample form (https://form.jotform.com/70340441809956) that I have created so you can have a closer look on the setup. To clone a form, just follow the instruction provided in this article: How to Clone an Existing Form from a URL.