Refreshing HTML SELECT OPTIONS after populating/selecting another field on the page
I have a number of SELECT statements which allow me to choose from OPTIONS created with ASP and an SQL Select on an (Access) database. I want to make subsequent SELECT's dependant on options selected from previous fields, and to populate these with the results of further SQL select statements. This is like the REQUERY facility within Access.
I can use onChange to execute a JAVA function held within the header block but cannot access SQL with this ... or can I ?
As you change the selections, the fields to the right change accordingly - is that what you wanted ??
By all means look at (and rip off !) the source code.
Basically what I did here was to query the database and return all of the values.
The values are fed into a series of javascript functions that create arrays.
Heres the messy bit - the arrays are unknown at development time - IE I dont know how many Contact Types there will be, and for each Contact Type how many Countries there will be, and for each Country, how many Cities there will be.
So, the JS functions create dynamically named arrays (yuck - a nightmare to document and debug !)
The arrays are then used to populate the <option> tags of the 3 <selects>; and I use onChange to re-populate the <option> tags of the successive <select> tags.
Not pretty, but it does work - and I'm pretty pleased with it. If you want to know more about this, let me know.
Bookmarks