Fields that are initially hidden, still appear in form.

  • EaseHealthcare
    Asked on February 27, 2021 at 5:54 AM

    I have multiple questions in my form where if someone chooses one of the options, a follow-up question will appear. For example, there is the question, "Do you smoke?". A 'no' response to this does not trigger anything. A 'yes' response triggers a follow-up question about how often the user smokes. If the user changes their response back to 'no', the follow-up question disappears.

    I chose to render this by initially making the follow-up questions hidden fields and then adding conditional logic to show the relevant follow-up question if the user chooses a specific response to the initial question. This solution works as intended. However, there is a bug where if the initial question is empty (no response) when the user first opens up the form, the fields that are meant to be hidden, appear. Once the user picks their response, the mechanism returns to working as intended, but that original display of all the follow-up questions is bad for user experience.

    My first idea to tackle this was to create an additional condition, where if the question is empty, then all the follow-up questions are hidden. This condition however overrides the fact that the fields are initially hidden, and therefore completely disrupts my mechanism.

    One solution to this problem is to prefill the question. However, due to the nature of the questionnaire, I am not allowed to do so.

    I am assuming that this issue is being caused by some bug related to the hidden field option that I am applying to my follow-up questions. If so, would it be possible to fix that bug? If not, could I have help understanding what is causing this behavior in my form?

  • Mike_G JotForm Support
    Replied on February 27, 2021 at 8:55 AM

    A field that you would like to show conditionally doesn't need to be hidden on the form from its properties.

    For Example, here's the condition that I only need to show a field based on another field's answer.

    1614432911 603a4a8f15a60 zt210227 083438 Screenshot 10

    Here's a test form: https://form.jotform.com/210573884384060

    On that form, the second field, Show if "Yes", is not hidden by default from its properties.

    1614433000 603a4ae878f3a zt210227 083624 Screenshot 21

    I have checked further and it could be that the issue you are having is caused by a conflict between conditions in your form. For Example, in this condition on your form,

    1614433102 603a4b4e55ef8 zt210227 082734 Screenshot 32

    #130, #131, and #132 fields will show if the "Yes" option is selected on the "Do you smoke?" field.

    However, there is another condition in your form that will only show one of the fields if the selected option in a field is "Birth Control Request".

    1614433391 603a4c6fad587 zt210227 084219 Screenshot 43

    And there is another condition that will only hide the fields if "Sexual Health" is selected from another field.

    1614433486 603a4cce3edcb zt210227 084348 Screenshot 54

    We will be glad to help you set up the conditions in your form to prevent such conflict. However, we may need for you to give us a detailed explanation of the workflow of your form and how you would like the conditions in your form to work.