Conditional Logic based on multiple choices responses

  • sherrythomas_temple
    Asked on October 29, 2021 at 4:24 PM

    I am building a jotform where selections on a multiple choice question will dictate which parts of the form appear. The question asks what type of request is being submitted (i.e., marketing, room set up, security, etc.) and additional questions will appear pertaining to which choices are selected. If someone chooses more than one selection, I am having difficulty configuring the logic to show/hide only the fields pertaining to those selections. Is there any easier way to do this? I am creating a condition for each individual selection to first show the fields I want and then another to hide the fields I do not want. However, when I test is and select multiple responses, the logic is not accurately showing/hiding the fields based on the conditions I set.

  • VincentJay
    Replied on October 29, 2021 at 7:16 PM

    Hello,

    Could you please provide us with an example of the issue so we can try and replicate it on our end?

    For example:

    If I choose Marketing, I want to show these fields and hide these fields.

    If I choose Calendar, I want to show these fields and hide these fields.

    If I choose both Marketing and Calendar, I want to show these fields and hide these fields.

    In this way, we can see if there's any condition conflict on the form.

    We'll wait for your response. Thank you!

  • sherrythomas_temple
    Replied on October 30, 2021 at 5:05 AM

    I think there will be conflict, because if someone selects marketing only, for example, all of the items pertaining to room set up, calendar, security, and staff attendance should be hidden and all fields pertaining to marketing should be shown. But, if someone chooses marketing AND security, now all of the fields pertaining marketing AND security should be shown, and all questions pertaining to the other selections (staff attendance, room set up and calendar) should be hidden.

    If I arrange questions so that I can skip or show pages, instead of logic which includes showing/hiding multiple fields, might that help? I am wondering if there will still be a conflict if multiple choices are selected on that trigger question?

  • Mike_G JotForm Support
    Replied on October 30, 2021 at 6:03 AM

    You can have all the fields that you need to ask your respondents on the same page regardless of what option they have selected. And, you can create different pages with fields specific only for each option.

    You can then use the Skip to/Hide a page conditional logic to hide pages on your form based on what option or options were selected.

    How-to-Create-Multi-Page-Forms

    How-to-skip-pages-using-conditional-logic

    As for hiding/showing fields on your form, you don't need to create a "hide field" condition for the"show field" condition you have created. When a "show field" condition is not met, the field is automatically hidden on the form.

    Feel free to let us know if you need any further assistance.

  • sherrythomas_temple
    Replied on November 1, 2021 at 6:14 AM

    I am still having difficulty getting the conditional logic to work the way I want it. The problem arises when two or more choices are selected in this trigger question:

    1635761505 617fbd61d075a  Screenshot 10

    If someone chooses marketing, for example, only the section with questions pertaining to marketing should appear and the rest are hidden, but if some selects marketing and room set up, marketing and room set up questions should appear and the rest hidden. I am not able to get the conditions set properly to show/hide fields and forms based on two or more selections in the question above.

    Thanks,

    Andrea

  • Bojan Support Team Lead
    Replied on November 1, 2021 at 7:14 AM

    Greetings Andrea.

    Can you please clarify, would you like to have these questions on different pages? I have checked your form, and you have pages for Security, Marketing and Communications, and Room set up. There are other pages, but they don't seem to be related to the What type of request are you submitting? question.

    If you wish to hide these pages, you will have to add Skip to/Hide a page condition:

    skip hide fields Screenshot 10

    In it, you need to check if an option is not selected, and then hide the related page, for example:

    screenshot 8077 Screenshot 21

    You will have to create a condition for every option you have.

    Have in mind that the last page can't be hidden, so you will have to create a new page that will only have the submit button, so you could hide the Room page.

    I have cloned your form and made changes to it, so Security, Marketing and Communications, and Room set up pages are visible only if those options are selected. You can test the form here:
    https://form.jotform.com/213042592856963

    If you wish us to provide conditions for other options, please let us know what fields should be hidden.

    Thank you for your cooperation.

  • Andrea Eiffert
    Replied on November 1, 2021 at 8:30 AM

    So, I had also created a clone and separated the sections into pages and I understand how to show/hide pages based on one response to the trigger question:

    1635769506 617fdca2516e0  Screenshot 10

    What I do not understand is how to show/hide multiple pages and/or fields if more than one response is selected. For example, in the clone I made, I set up the conditional logic to hide pages 3-5 if marketing is selected and to hide pages 2-4 if room set up is selected. But if marketing and room set up are both selected, only page 2 appears and not page 5. (Pages 1 and 6 will always appear for all respondents)

  • Richie JotForm Support
    Replied on November 1, 2021 at 9:42 AM

    I would suggest using the section collapse in your form instead of multiple page breaks.

    firefox XAvSDIIwCi Screenshot 10

    With the Section collapse, you can add the fields that you don't want to show and based on the condition, you show the section only.

    Here is my sample form:https://form.jotform.com/213043294432953

    You can clone my form to check the condition and setup.

    https://www.jotform.com/help/42-how-to-clone-an-existing-form-from-a-url/

    Let us know if this fits your requirements.

  • sherrythomas_temple
    Replied on November 1, 2021 at 1:19 PM

    This has been incredibly helpful; thank you so much! I believe the form is just about ready for testing but I have been unable to get this one final condition to work properly and wonder if you can tell me what is wrong?

    Field 27 does not show up when I select calendar request on question 6:

    1635782997 6180115520293  Screenshot 10


  • VincentJay
    Replied on November 1, 2021 at 2:52 PM

    May I know what form are you working on?

    I cloned this form (https://form.jotform.com/212937551674059) and all conditions associated with field 27 are incomplete.

    1635792413 6180361d7c29e cdzr5125 Screenshot 10

    Could you please disable them or remove them if you're not going to use them? After that, please test the form again and let us know if the issue still persists.



  • sherrythomas_temple
    Replied on November 1, 2021 at 2:55 PM

    I was working off the form that you cloned before: https://form.jotform.com/213044308513142

    This is the condition on that form which does not appear to be working correctly:

    Field 27 does not show up when I select calendar request on question 6:

    1635782997 6180115520293  Screenshot 10

  • sherrythomas_temple
    Replied on November 1, 2021 at 2:56 PM

    I was working off the form that you cloned before: https://form.jotform.com/213044308513142

    This is the condition on that form which does not appear to be working correctly:

    Field 27 does not show up when I select calendar request on question 6:

    1635782997 6180115520293  Screenshot 10

  • VincentJay
    Replied on November 1, 2021 at 4:15 PM

    Thank you for providing the correct form.

    The field is already inside the Section Collapse condition. You need to trigger/show the Section Collapse condition before you can see the field you're referring to.

    I hope this information helps. Let us know if you need further assistance. Thank you!

  • sherrythomas_temple
    Replied on November 1, 2021 at 4:25 PM

    But what happens if I trigger that section and only want to show one field in the section and hide the others?

  • sherrythomas_temple
    Replied on November 1, 2021 at 4:41 PM

    Actually, I think I fixed it. I moved it to the first section and set the condition to show that question if calendar is selected. Thanks

  • VincentJay
    Replied on November 1, 2021 at 6:01 PM

    Thank you for updating us.

    We're glad that you managed to find a solution to the field.

    Please message us again if you need help.