Stretchwickster
Programmer
Hi there,
I'm currently working on a web form which has dynamically populated drop-down boxes. I would like to implement the following behaviour amongst the drop-downs: when an option is selected in drop-down A it affects the contents of drop-down B.
Ideally, what I would like to do is run a database query on the server, without reloading the page, when the option in drop-down A is selected (because drop-down B may have several thousand options if no filter were applied to it).
One way I can think of would be to build a javascript array of all the options when the page is first loaded, catch the onchange event when an option is selected in drop-down A, and add the appropriate options to drop-down B.
I'm not sure if this is the best way to go in terms of speed as there will be a lot of items to be processed in the various arrays.
Is there a solution which is better suited to this scenario? I would greatly appreciate your views as to the best way to tackle this.
Clive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
I'm currently working on a web form which has dynamically populated drop-down boxes. I would like to implement the following behaviour amongst the drop-downs: when an option is selected in drop-down A it affects the contents of drop-down B.
Ideally, what I would like to do is run a database query on the server, without reloading the page, when the option in drop-down A is selected (because drop-down B may have several thousand options if no filter were applied to it).
One way I can think of would be to build a javascript array of all the options when the page is first loaded, catch the onchange event when an option is selected in drop-down A, and add the appropriate options to drop-down B.
I'm not sure if this is the best way to go in terms of speed as there will be a lot of items to be processed in the various arrays.
Is there a solution which is better suited to this scenario? I would greatly appreciate your views as to the best way to tackle this.
Clive
![Runner_1Revised.gif](http://dev.slydance.com/images/Runner_1Revised.gif)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096