I am looking for a POEAA
I have a standard ASP.NET MVC View with tons of input controls. The visibility of the controls is triggered based on inputs from 2 main dropdown controls. for e.g. DropDown1 with value A and DropDown2 with value B will show only few controls from the full list and will also change the mandatory requirements.
How should I design the view?
-
Write java script and hide/unhide based on the DropDown combinations.There can be 30 combinations so might be challenging to manage on new controls and combinations
-
Create a table in database that will give a list of control ids for each combination and then on client side loop through it to hide/unhide?
-
Any other patterns someone can suggest? Aim is to keep it clean and manageable
Real World Example
Working on a property listing form. Based on the selected property type and transction type, the controls are hidden/shown.
For e.g. Bedrooms and Bathrooms do not apply to a Plot/Land. There are 2 dozen such controls whose visibility needs to be managed based on the property type/transaction type comibination.
The list can grow…
Thanks,
Pinakin
I would suggest looking at a more reactive approach by implementing the MVVM pattern and would suggest looking at knockout.js as a method of binding your model to your controls and their attributes such that changing your model will have effects beyond the value being changed.
Hopefully this will give you some ideas on how to move forward but I stand by my original comment, look to re-evaluate how you are presenting the user interface. 30 controls on a single view is too much. Break it down into smaller chunks, if it’s tough for you to manage then it’s tough on the user too.