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

    Required field conditions?

    Asked by slave8 on July 29, 2011 at 01:59 PM

    I have 4 fields that are required to be filled out at the end of my form. I also have a check box above these 4 fields that I would like to act as an deciding factor if the later 4 fields are to be required or not. Here is an example:

    User gets to end form section:

    User is asked (with checkbox) if they want to pay with check or enter card info below (the 4 required fields).

    If the user does not check the box they must then fill in the remaining 4 input fields as they are required to submit the form This is how the form would run normally).

    If user checks the box (meaning they would like to send a check versus using the online card information) then the (required) validation on the following 4 input fields is eliminated/nulled out and they are able to submit the form without filling in any card information.

     

    I am thinking that somehow in Dreamweaver I should be able to add code in that says something like:

    if input_24_0 == yes then form-textbox validate[null] else form-textbox validate[required]

     

    Is this possible or too much or am I over thinking it?

  • Profile Image
    JotForm Support

    Answered by NeilVicente on July 29, 2011 at 04:40 PM

    Hi,

    This is possible with Jotform itself - no need to add codes in Dreamweaver. What you can do instead is to use conditions to hide the credit card fields if the user checks the box. The fields would still need to be set as 'Required'. The 'Required' validation won't work anyway if these fields are hidden, so it serves the same purpose with what you want to implement.

    Take this form for example, notice that the 'Previous Employer' fields only show when you choose "No" as the answer for "Currently Employed".

    Here are the conditions I have set for that form

    You can also apply the same logic to your form.

    To learn more about conditional logic, please click the link below:

    Conditional logic in forms

    Please let us know if you need further assistance with this topic. Thank you and have a nice day!


    Neil