Is it possible in a dropdown field to eliminate option when it is used in another dropdown?

  • psdarmin
    Asked on September 21, 2015 at 4:11 PM

    Hi!

    Is it possible that when you use dropdowns for a quiz, when you already have used that option in one dropdown, that you eliminate it from th other dropdowns?

     

  • Elton Support Team Lead
    Replied on September 21, 2015 at 7:12 PM

    Hello,

    Technically that's possible using show/hide condition but it would require a lot of conditions as you add more dropdown fields.

    https://www.jotform.com/help/57-Smart-Forms-Using-Conditional-Logic

    Example:

    http://form.jotformpro.com/form/52637791142963?

    Setup:

    Is it possible in a dropdown field to eliminate option when it is used in another dropdown? Image 1 Screenshot 20

    Or, you can also try this widget if you want http://widgets.jotform.com/widget/dynamic_dropdowns. Using this widget, you can define child dropdowns to show depending on the selected option on the parent dropdown but you also have to define the options on each of the child dropdowns so there's a workload involve.

    Hope this helps!

  • abajan Jotform Support
    Replied on September 22, 2015 at 12:23 PM

    @psdarmin

    As my colleague has stated, if your quiz form has several dropdowns (like dozens or even hundreds) you may find yourself having to do a lot of work if implementing this in the form builder. In such cases, embedding the form's full source into a webpage and adding a script to the same page may be a better route to take.

    Here's a webpage employing such a solution. The script at the bottom is designed to accommodate any number of dropdowns. Moreover, the dropdowns need not be identical as there are in the demo. All the script is concerned with is that no two selected answers be the same, unless they're the default (blank) option. If there are no intervening dropdowns between the quiz's questions, this more robust version of the script can be used, as illustrated in this other demo.

    If you need assistance with this method, we'd be happy to provide it.


    Thanks

  • abajan Jotform Support
    Replied on September 25, 2015 at 10:58 AM

    Hi again,

    Please test this shortened version of the previous demos that contains an edited version of a script I found online. As you'll see, instead of triggering a message whenever an already selected option is chosen, the option is removed (which is what you actually wanted to occur). I made the first six options in each dropdown visible, only so that you could see the updating happening in real time. Just like the previous demos, it will work for any number of dropdowns and it doesn't matter if they all have the same options or same number of options.

    Do inform us if you run into any issues while applying this workaround, assuming you use this method.


    Enjoy your weekend.