Limit Drop Down Options Using Dependent Fields

Mike Bilz asked on October 4, 2018 19:48

Hello Kentico Team,

I need to build a form with 150 options to select from for one field. Obviously, asking a user to scrub through 150 options to find what they need isn't really a great option. My hope is to programmatically limit what options appear within the drop down based on the users selections in other dependent fields.

For example, the form would have three fields "Department", "Type", and "Selection". All 150 options would be programmed into the Selection drop down, but which options appeared to the user would depend on their choices in the Department and Type fields.

I'm pretty sure that something like this is possible, maybe using custom tables or external files, but I am barely sure of how to ask the question.

Does anyone have any ideas on how something like this can be accomplished?

The fast and dirty way to do this is to create a whole bunch of smaller drop down lists, and only show the one list that matches the users choices in the other two fields. But doing it this way would be very difficult to manage and update. Not to mention that each of those drop downs would have a different field name, so any reporting I do would need to be cleaned up by hand.

If anyone has any ideas, or can point me in a good direction for how to solve this I would really appreciate it.

Thanks in advance.


Recent Answers

Rui Wang answered on October 4, 2018 20:00 (last edited on October 4, 2018 20:01)

Hi Mike

I have done 2 drop downs with the 2nd one depending on 1st one. Example, first drop down "Region" has these options: * New England * Tri-state

Second drip down's option contains macro

{% if (Region.Value == "New England"){ %}
{%} else { %}
{% }#%}

In your case, it could be massive conditions and list for the drop downs.

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on October 5, 2018 01:09 (last edited on October 5, 2018 01:13)

I think you should clone drop down and create you custom dropdown with jQuery plugin that lets you search things. Try Selectize, here is an Example

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.