Click to See Complete Forum and Search --> : Refreshing HTML SELECT OPTIONS after populating/selecting another field on the page


cpurchase
02-12-2003, 06:31 AM
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 ?

Any ideas ?

cpurchase
02-12-2003, 07:29 AM
Thanks Dave .... I will look into the first option ... if you know where I might be able to find an example perhaps you could let me know. Cheers.

nathan.russell
02-12-2003, 09:11 AM
Is this the kind of thing you are looking to do ??

http://www.quantel.com/domisphere/infopool.nsf/html/contacts

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.

Regards

Nathan
nathan.russell@quantel.com

cpurchase
02-13-2003, 09:54 AM
Thanks Nathan .... this is just what I need. I will give it a go.

Chris