Create a form that checks if the entered value is a multple of a specific number

  • whatsyourvape
    Asked on January 17, 2018 at 11:47 AM

    Can I use conditions to require that a specific multiple be used for a quantity?

    In other words, Can I require that a person order a quantity that is a multiple of a certain value?

  • Mike_G JotForm Support
    Replied on January 17, 2018 at 12:31 PM

    Using conditions, it is possible to create an equation and check if a number entered on a field is a multiple of a certain number/value.

    After that, you can have another condition to show/hide the submit button based on the result of the equation. You can also create a message using Text (HTML) field that will show if the conditions are not met.

    Here's a sample form — https://form.jotform.com/80164693496972

    Feel free to create a clone version of that form in your account so you can inspect it.

    You may also find the guides below helpful:

    How-to-Manipulate-Text-String-with-Conditions-and-Calculation

    How-to-Perform-Form-Calculation-Using-a-Widget

    Calculate-Values-in-the-Input-Table-Through-Condition

    How-to-Perform-Form-Calculation-in-the-Matrix-Field

    And if, in any case, I have misunderstood your concern, please feel free to let us know.

  • whatsyourvape
    Replied on July 3, 2018 at 12:01 PM

    Hi, I have a combination of calculations and conditions to force ordering in multiples of 5. However, if the total entered, adds up to an even number, the order will still go through. Any ideas on how to close this loophole?

  • Mike_G JotForm Support
    Replied on July 3, 2018 at 1:51 PM

    I have checked the form you are currently working on and noticed that you have added all the fields in the Pods (input) table into another field. Then, you have divided the total by 5 to conditionally check if it will have a decimal point in its quotient and hide the submit.

    I understand that it will create an issue if the total of all the fields in the Pods (input) table would be divisible by 5. (For example; 3pcs — 18mg Tobacco, 2pcs — 36mg Fruit, and 5pcs — 48mg Scorpio).

    To fix the issue, I suggest that you do the following:

    Step 1 —  update the condition below from:

    1530637579t13 05 29 Screenshot 10

    To:

    1530637637t13 06 41 Screenshot 21

    Step 2 — Delete the Pod Quantity Calculation

    1530637763t13 07 59 Screenshot 32

    Note: Only delete the field if there is no data associated with it.

    Step 3 — Remove all the "+" signs from the Pod Quantity Total

    1530638051t13 13 Screenshot 43

    Step 4 — Enclose every tile that represents each cell (field) in the Pods (input) table in parenthesis. Make sure that each parenthesis is a "String" and not a "number" (click to change).

    1530638809t13 24 41 Screenshot 54

    Step 5 — Divide each cell (field) in the calculation by 5.

    1530639811t13 42 55 Screenshot 65

    Here's how it works.

    1530640150t13 46 01 Screenshot 76

    I hope this helps. If you have other questions or concerns, please do not hesitate to let us know.

  • whatsyourvape
    Replied on July 3, 2018 at 2:37 PM

    Worked perfectly! Thank you so much!