How Do I Prevent the Value Entered in a Number Field from Being Greater than That Entered in Another Number Field?

  • DPCREATE
    Asked on November 3, 2015 at 4:24 AM

     

    Hi 

    I have 2 number fields, i need to prevent the value entered in num2 being greater than num1 

    num 1 

    num 2

     

    How can i do this?

     

    thanks

  • beril JotForm UI Developer
    Replied on November 3, 2015 at 9:09 AM

    Hi,

    As far as I know, it is not possible with JotForm. However, you can add a Hover Text as o solution.

    How Do I Prevent the Value Entered in a Number Field from Being Greater than That Entered in Another Number Field? Image 1 Screenshot 30

     

    Here is how it works: 

    How Do I Prevent the Value Entered in a Number Field from Being Greater than That Entered in Another Number Field? Image 2 Screenshot 41

    If you have any question or issues, please do not hesitate contacting us. We will be glad to assist you.

  • abajan Jotform Support
    Replied on November 3, 2015 at 10:12 AM

    In addition to my colleague's workaround, you could add a text element containing an error message to the form and then setup a condition to both show the message and hide the submit button whenever num 2 is greater than num 1. (Once the submit button of a jotform is hidden, submission isn't possible).

    Here's a form demonstrating the functionality. If you clone it you'll see it contains the following condition:

    How Do I Prevent the Value Entered in a Number Field from Being Greater than That Entered in Another Number Field? Image 1 Screenshot 20


    If you need help implementing this setup, please inform us.

    Cheers

  • paul_x
    Replied on November 3, 2015 at 11:29 AM

    Hi everyone !

    I used a spinner field because it offers both the functionality of a regular spinner (increase & decrease buttons) + you can manually enter the number in the field just like what you do with a regular text box or number field.

    This is the end-result of the live form I did (this can be cloned).

    How Do I Prevent the Value Entered in a Number Field from Being Greater than That Entered in Another Number Field? Image 1 Screenshot 30

    * #2 spinner value is programmed not to exceed the value of #1 - even if you press the up-spinner button (increment).

    * And if #1 = #2, and you decrease the value, the value of #2 then = #1.

    * Else, #1 & #2 values are independent of each other.

     (hopefully the conditions are error-proof)

     

    Conditions used in this sample form:

    How Do I Prevent the Value Entered in a Number Field from Being Greater than That Entered in Another Number Field? Image 2 Screenshot 41

     

    Hope this helps.

     

    - Paul

  • victor
    Replied on November 3, 2015 at 1:50 PM

    Thanks @paul_x, this is also another of accomplish this task.

    Thanks for the sample form.