Forum Moderators: open

Message Too Old, No Replies

get multiple form fields

         

hoju312

8:17 pm on May 11, 2006 (gmt 0)

10+ Year Member



I'm building a form that has 3 drop downs, I want the selections in the first 2 to determine the options in the 3rd. I've done similar ones where the first determined the 2nd which determined the 3rd, but I have no idea how to do this one.

Fotiman

8:48 pm on May 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The first 2 would have an onchange event handler that called your function for defining the 3rd options. For example:

function setSelectOptions()
{
// Get the selection from the first select box
var s1 = <get your selected value here>;
// Get the selection from the second select box
var s2 = <get your selected value here>;
if( s1 == 'a' && s2 == 'z' )
{
// Set select box 3 options to some set
// ...
}
else if( s1 == 'a' && s2 == 'y' )
{
// Set select box 3 options to this set
// ...
}
else if( s1 == 'b' && s2 == 'z' )
{
// Set select box 3 options to this set
// ...
}
else if( s1 == 'b' && s2 == 'y' )
{
// Set select box 3 options to this set
// ...
}
// Etc.
}

Hope that helps.