Preventing Required fields if hidden via conditional logic

  • charitychallenge
    Asked on November 5, 2014 at 6:10 PM

    I have a radio button choice:

    Male/Female

    Dependent upon the selection, one or another dropdown field is hidden or appears with Shirt Size choices (obviously Men's size choice dropdown field for Male, or Ladies size choice dropdown field for Female). 

    I need to make the Dropdown size field choice Required/Mandatory, but only subject to the Gender that was selected.  Obviously, if Male is chosen, I need the Men's shirt size choices only to show and to force a minimum of one size selection and therefore keep the Ladies Shirt size dropdown hidden and not force a selection of one of these - and vice versa.

    At present, if I make both Dropdown fields required to ensure a size is selected, this appears to override the condition to Show/Hide if the other Gender is selected.

    I'm sure there is another way around this, or maybe it should work and I have simply not implemented or tested properly.

    Hope I have clearly explained.

    The example I have included presently has the Male and Female Shirt Size dropdown fields each set to required.

  • Charlie
    Replied on November 5, 2014 at 8:39 PM

    Hi,

    I'm not sure if I understood you correctly, but upon checking you account it seems that there are some conflicts with your condition. I've cloned it and made a couple of changes, you can check the screenshot below as a quick guide and demo.

    1. I added a condition to show the "Polo Shirt Size" field for Male when the "Gender" field selected is "Male", then same with the female condition. I disabled your conditions that hide the fields because this will conflict with the ones I created.

    Preventing Required fields if hidden via conditional logic Image 1 Screenshot 20

    2. Here's the URL of the cloned Form that I edited:

    http://form.jotformpro.com/form/43087530538962 

     

    See if the changed that I made is the one that you are looking for or you want to achieve.

    Let us know if this works for you.

    Thank you.

     

     

  • charitychallenge
    Replied on November 5, 2014 at 8:54 PM

    Thank you - you did understand my question

    Your answer is fine but I have one other related question.

    In my example, if I accidentally choose Male and set shirt size to XL, but then change to Female and set shirt size to S, the Male Shirt Size field will still have a value in it (won't it?).

    Is there a way I can set (in this example) the Male Shirt Size to null if Female gender is chosen, or vice versa?

    Thanks

  • Ashwin JotForm Support
    Replied on November 5, 2014 at 10:06 PM

    Hello charitychallenge,

    In my example, if I accidentally choose Male and set shirt size to XL, but then change to Female and set shirt size to S, the Male Shirt Size field will still have a value in it (won't it?).

    Actually if you input a value in a text box and then based on some condition if that text box is hidden, data will not be saved of that text box.

    You can test it yourself in your form. If you select Male and select the shirt size, change the gender selection to female, select the female shirt size and submit form - dropdown value of the male shirt size will not be saved.

    Hope this answers your query.

    Do get back to us if you have any questions.

    Thank you!

  • charitychallenge
    Replied on November 5, 2014 at 10:48 PM

    Yes - thanks, I saw this was the case.  Great.

  • Ashwin JotForm Support
    Replied on November 5, 2014 at 11:16 PM

    Hello charitychallenge,

    You are welcome.

    Do get back to us if you have any questions.

    Thank you!