I have two drop down menus, the first a list of Departments, the second a list of Sections.
Each Department has a set of Setions, so the Sections dropdown contains complete list of all Sections for every Department. I would like to filter out the Section dropdown based on what Department the user selects, to stop the user selecting a Section not relevant to the chosen Department.
The Section list is very long other wise I'd just hard code a few lists and hide/unhide based on the selection made in Departments.
Now, the Department list contains a value (which is the CODE for the Department) and for the user experience it contains the textual Department Description, eg 'I.T' displays as I.T. but the form would submit '1', 'Personnel' would submit '2' etc.etc.
The same applies for the Sections list, IT Systems would for example submit the value of 001, IT Networks would submit 002 etc etc.
Theer is a link between the two lists, in that the Section lines also include it's department code, so when the Department is Select Javascirpt would use the returned value (eg '1') and look through the list of Sections for all prefixed with '1'.
Here's a sample of each Select box.
Department:
Expand|Select|Wrap|Line Numbers
- <option value="None" selected>* * Please Select * *</option>
- <option value="0010">I.T</option>
- <option value="0020">Personnel</option>
- <option value="0030">Busness</option>
Expand|Select|Wrap|Line Numbers
- select size="1" name="SECTEST" id="SECTEST">
- <option value="None" selected>* * Please Select * *</option>
- <option value="0001">0010|EMERGENCY PLANNING</option>
- <option value="0002">0010|HEALTH AND SAFETY</option>
- <option value="0003">0010|PRESS AND PUBLIC RELATIONS</option>
- <option value="9998">0010|GENERAL (CHIEF EXECUTIVE)</option>
- <option value="0001">0020|CONSERVATION/REGENERATION</option>
- <option value="0002">0020|COUNTRYSIDE SERVICE</option>
- <option value="0003">0020|DEVELOPMENT CONTROL</option>
- <option value="0004">0020|ENFORCEMENT</option>
- <option value="0005">0030|ADMINISTRATIVE SUPPORT</option>
- <option value="0006">0030|RESEARCH AND INFORMATION</option>
- <option value="0007">0030|POLICY</option>
- <option value="9998">0030|GENERAL (PLANNING)</option>
So I could do with some Javascript which limits the second dropdown.
Thanks in advance.