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 to make the Coupon Code field of the payment tool required?

    Asked by blueforms on March 31, 2016 at 11:39 PM

    btw.. I have entered multiple coupons, I need the user to enter at least one for the form to be submitted.

    This is a re-post of a comment on How To Add Coupon Code in the Payment Form

  • Profile Image
    JotForm Support

    Answered by Mike_G on April 01, 2016 at 05:50 AM

    Unfortunately, we cannot make the "Enter Coupon" field of the payment field required but there is a workaround that you can do to achieve such.

    I will get back to you as soon as I have finished creating the steps of the workaround. 

    Thank you for your patience.

  • Profile Image
    JotForm Support

    Answered by Mike_G on April 01, 2016 at 10:29 AM

    Here's the workaround:

    First, here are some of the fields that you will be needing for this workaround.

    Checkbox field for your products - this is where your products will be listed.

    Textbox field for the coupon code - this is where the coupon code is to be entered. This field should be set as required.

    Textbox field for the discount percentage - this will hold the discount percentage that would depend on the coupon code being entered. This field is hidden and will not be seen on the form.

    Text field for the "Coupon Code is invalid" message - this field is hidden and will only appear if the coupon code is not valid.

    Once you have put in the fields above to your form, next thing that you will do is to create conditions to make the coupon code validity check work.

    First, create a condition that will update the "Discount" field if the coupon code entered is correct.

    Sample coupon codes:

    XX23KL - 10% discount will be applied

    WQ123X - 15% discount will be applied

    You can add multiple rules if you have the same amount of discount for different coupon codes.

    Second, create a condition that will make the value of "Discount" field equal to "1" if the coupon codes entered didn't match the coupon codes you set as correct.


    Third, create a condition that if the "Discount" field is equal to "1" AND "Enter Coupon Code" field is filled, hide the submit button and show "Coupon Code is invalid" message.

    Fourth, create a condition that if the coupon code entered match any of the codes you have set, it will show the submit button and hide the "Coupon Code is invalid" message.

    Or instead of checking if the coupon codes matches, you can also have this condition: if the "Discount" field is not equal to "1", show the submit button and hide the "Coupon Code is invalid" message. You may use either of the two and you will still get the same result.

    Lastly, if the "Enter Coupon Code" field is empty, hide the "Coupon Code is invalid" message and show the submit button.

    That is how we can make the Coupon Code field required.

    However, to make the process clear, it is important to set the priority of each condition and that can only be done by dragging the conditions to its proper place.

    Now, after setting all the conditions above, you will then set the value of each product by setting calculation values for each item.

    After that, you will need the Form Calculation widget for the computation of your total product after discount. This field should be hidden since its value is just going to be passed to the payment tool field. Here's how it should be set.

    Here's how it works:

    Here's the form I have used for testing: https://form.jotform.com/60912448280960

    Feel free to clone the form so you can examine it.

    If you have any questions regarding any of the instructions above, please feel free to ask us through this thread.

    Thank you.