Required field conditions?

  • Profile Image
    slave8
    Asked 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
    NeilVicente
    Answered 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