Hello,
I was wondering if anyone can help me with a problem that I¹m having. I¹m
building a form where the user selects an option from a drop down menu.
Then after the option is selected the form changes. By changes I mean that
different text fields or checkboxes are shown depending on what option is
chosen in the first select tag. Can anyone help me with this or point me in
the right direction.
Thanks!
Jason
Joe Fawcett - 26 Sep 2004 11:00 GMT
Hello,
I was wondering if anyone can help me with a problem that I'm having. I'm
building a form where the user selects an option from a drop down menu.
Then after the option is selected the form changes. By changes I mean that
different text fields or checkboxes are shown depending on what option is
chosen in the first select tag. Can anyone help me with this or point me in
the right direction.
Thanks!
Jason
Start by attaching an event handler to the select box:
<select onchange="handleSelectChange(this);">...
then in your function retrieve the value currently chosen and make changes:
function handleSelectChange(Select)
{
var oOption = Select.options[Select.selectedIndex];
//Test
alert(oOption.text + "\n" + oOption.value);
switch (oOption.value)
{
case 1:
//Do something
break;
case 2:
//Do something else
break;
// More...
}
}

Signature
Joe (MVP)