How to conditionally empty a selection in a radio button field to hide other fields?

  • oliverpowell
    Asked on March 17, 2017 at 1:22 PM

    Hello, I have conditions on my form that Hide and Show elements but if a user changes their first answer the form doesn't change back to its original state.

     

    1. A user picks selection from auto-complete drop-down (I'm using "Test" as an example)

    2. User is then presented Yes/No Question based on drop-down selection

    3. More questions are displayed

     

    If a user deletes the entry from auto-complete drop-down in step 1 the entire form is still visible and I can't work out how to hide it without interrupting the other conditions applied.

     

    Jotform Thread 1094697 Screenshot
  • Jan
    Replied on March 17, 2017 at 4:12 PM

    I was able to replicate the issue. Please try creating a "Does Not Contain" condition. In this way, if the "Name" field does not contain "Test A, Test B, Test C" then the fields below will be hidden. You can hold down the "Shift" key or "Ctrl" key to select multiple fields.

    How to conditionally empty a selection in a radio button field to hide other fields? Image 1 Screenshot 30

    Here's the result:

    How to conditionally empty a selection in a radio button field to hide other fields? Image 2 Screenshot 41

    Hope that helps. If you need further assistance, please let us know. Thank you.

  • oliverpowell
    Replied on March 17, 2017 at 7:05 PM

    Hi, thank you. I've added the "Does Not Contain" condition as you suggest, however, all the fields from the entire form are now being displayed after selecting an option in the dropdown.

    I should only be able to see the Yes/No after selection, but all my fields are displaying, even the ones that are set to hidden.

  • Support_Management Jotform Support
    Replied on March 18, 2017 at 4:12 AM

    I'm seeing the same when I checked your form. However, we need to further understand what you want to happen once Test A or Test B or Test C has been selected.

    From how it's setup right now, there are no conditions that handle each specific selection made on the Autocomplete Widget.

    e.g.

    IF Autocomplete IS EQUAL TO Test A DO ...

    IF Autocomplete IS EQUAL TO Test B DO ...

    IF Autocomplete IS EQUAL TO Test C DO ...

    Perhaps adding these conditions first based on your requirement would help us in figuring out which condition fails to trigger or what causes it to not trigger.

    Your workflow looks something like this based on how I understand it:

    1. If Autocomplete is blank, don't show anything

    2. If Autocomplete contains any of these Test A, Test B, Test C then show Are you attending

    3. If Are you attending is equal to Yes then show Email, Any dietary requirements, Are you staying nearby

  • oliverpowell
    Replied on March 18, 2017 at 6:46 AM
    Yes you are right "If Autocomplete is blank, don't show anything"
    But I can't get this to work without all of the fields showing up and not sure what condition to set. I've tried setting "Is Empty", but anything that is typed into autocomplete just shows the entire form. "Are you attending" should only appear if you select an autocomplete value and the rest of the form which is hidden should only ever show if a value from "Are you attending" has been set.
    I do have this working to an extent, so if you remove a value or type something that doesn't match in the autocomplete, "are you attending" would disappear as expected but the problem is that the remaining form stays visible, it should also disappear.
    Many thanks
    Sent from my iPhone
    ...
  • Support_Management Jotform Support
    Replied on March 18, 2017 at 1:52 PM

    Thanks! I checked your form once again and it looks like you finally figured it out. Here's how I see the form when I select Test A from the Autocomplete Widget:

    How to conditionally empty a selection in a radio button field to hide other fields? Image 1 Screenshot 20

    In case you need more help, just let us know.

  • oliverpowell
    Replied on March 18, 2017 at 2:46 PM
    Hi,
    It's not quite working because after you click *yes* or *no* in "*are you
    attending*", you can then change the value in the *autocomplete*, and at
    this point the "are you attending" disappears and you can Submit the form.
    I'm trying to create a form where users can't proceed or submit the form
    unless they have selected a value from the autocomplete.
    Many thanks
    ...
  • Mike_G JotForm Support
    Replied on March 19, 2017 at 1:35 AM

    Thank you for the additional information and for describing the issue that you're still having with your form. I believe what you need in your form is something that will "empty" the selection made in the "Are you attending" radio button field if the "Auto Complete" widget is filled (or filled again). This is possible to achieve. Just add the condition below to your form and that should solve the issue you're having.

    How to conditionally empty a selection in a radio button field to hide other fields? Image 1 Screenshot 30

    As for the result, please see screenshot below.

    How to conditionally empty a selection in a radio button field to hide other fields? Image 2 Screenshot 41

    Notice that when I change the value of the "Auto Complete" widget the "Are you attending" radio button field becomes hidden and empty at the same time. That is why the other fields are hidden as well. Giving a correct value to the "Auto Complete" widget will show an EMPTY "Are you attending" radio button ready to take a selection again.

    I hope this helps. If you have any further questions or concerns, please feel free to contact us again anytime.

    Thank you.