Skip to main content
Inspiring
June 2, 2006
Question

Second Dropdown/Select list situation

  • June 2, 2006
  • 2 replies
  • 257 views
i've got 2 dynamically created dropdown lists on a page. the 2nd list
runs a query based on the option chosen in the first list.

after the user chooses an option in the 1st dropdownlist, i've got an
onChange event handler that submits the FORM
(onChange="this.form.submit()").

my problem is that when the 2nd form appears and is ready for the user
to choose an option - the 1st form's value goes back to the default
where it say "Select Catgory". i need the 1st form to retain the
option actually chosen by the user.

is this a javascript solution? if so, how?

is this a cold fusion solution?

oh. the first dropdown used a regular HTML <FORM> tag. the 2nd
dropdown uses a <CFFORM> (i'm not sure if that means anything or
not)

    This topic has been closed for replies.

    2 replies

    Inspiring
    June 2, 2006
    This can be done with javascript. In fact in is better to do it with javascript. The concept is called related selects. You can google those words and probably find something. There is also a custom tag out there that a lot of people use. I also posted some code on how to do it. Look for the word etilology.
    June 2, 2006
    Hi,

    This can be done in cold fusion only. Suppose name of the first select box is "select1" then check the first select box as follows


    <cfparam name="form.select1" default="">
    <select name="select1">
    <option value="">select category</option>
    <option value="1111" <cfif form.select1 eq "1111">selected</cfif>>1111</option>
    <option value="2222" <cfif form.select1 eq "2222">selected</cfif>>2222</option>
    </select>


    also there is no need of two forms, this can be done with single form also.