
I have a menu with several DropDowns. I added the code, but currently it is completely in the code file. I want to use any design template for an easy and uncluttered way to select options.
The report generation criteria are prepared as follows:
Report Type DropDown options include:
- Type of circuit
- Circuit wise
- Wise district
- Crisscross
- Everything
By default, only the first DropDown is enabled. After selecting an option from this DropDown, enable the corresponding DropDowns.
Not only that, the values of Scheme , District and Block DropDowns also change if an item is selected from any of these DropDowns or Scheme Type DropDown using AJAX .
It includes many SQL queries and frequent enable / disable DropDowns. My current code is cluttered with many IF and EndIfs .
I want to know whether to use an Observer pattern or any approach using Classes to simplify this operation. Any way to make this multiple choice and populating DropDowns manageable and simple?
Edited below to clear requirements
Let me clarify further.
The first DropDown is the key DropDown, which is enabled by default when the page is opened. By default, all other DropDowns are disabled. But this does not mean that Cascading DropDown is the right choice, because the choice from the child DropDowns is random.
The whole plan is to simplify the code in an understandable way for each DropDown. There are many Ifs and ElseIfs involved to select the correct request depending on the choice.
For example: a user selects a District-wise report from the main DropDown report type. In this case, three child DropDowns are included, namely:
Scheme Type Scheme District
If the user selects “ALL” from the list of chart types, all chart types in all categories are populated in the DropDown chart.
If the user selects a specific type of scheme from the parameters: Urban, Rural or Other, the DropDown scheme filters the name of the schemes.
Scheme DropDown now also has the ALL option. The user can select ALL or select any specific scheme.
The same applies to the county. If ALL is selected, the schemes in the DropDown scheme accept all schemes in all districts, but if a specific district is selected, the Dropdeown Schede must fill out the filtered schemes of that region.
Note that in this case we are moving in the reverse order, because District DropDown filters the DropDown schemes again.
The same applies to Block DropDown.
There are many conditions for checking another selected parameter. Suppose the user has not selected any options, or the user selects ALL.
I want to create separate classes with the names of each DropDown. These classes must retain Observer notifications for any changes to DropDown.
I think I could clarify.