|
Richard Dudley -> RE: Dynamic Drop-Down List (3/12/2004 8:11:14)
|
I'm assuming that for this example, the values in box 2 rely only on the selected value in box 1, and the values in box 3 correspond only to the value in box 2, and the values in box 4 rely only on the selected value in box 3 (the example I just finished did not, and was a little more complicated). I'm also doing this off the cuff, so some parts may need a little clarification later. For your database, you need to set up tables containing the values for box 2, 3 and 4 (hard code box 1 unless it will change often). The table should have three columns--parent value, value, and text. Each select box will fire a small javascript in the onChange event. Something like onChange="fncFillNext(this.id)". The javascript function will basically submit this form to itself. This is one of those parts that will require some elaboration. A form handler on the page reads the value of what box was selected (from this.id), and what the selected value is, and retrieves the values of the next box from the database. This information is used to populate the select box. It's a little simpler, but requires four loads of the page.
|
|
|
|