Page 1 of 1

Display two Textboxes on change of drop down list

Posted: Tue Jul 22, 2008 3:17 am
by Madhum
Hi to all,

i have a data entry form with a drop down list.in drop down its having personal & office options to select.when user select personal,next to drop down it should be display a textbox.then user fill his personel telephone number.then user select the Office from the same drop down and again it is displaying another textbox in same place of first textbox.
i have a code to do this.but it's displaying text boxes in two places.this is the code.

<select onchange="if (this.selectedIndex==2){this.form['box'].style.visibility='visible'}else {this.form['box'].style.visibility='hidden'} if (this.selectedIndex==3){this.form['box1'].style.visibility='visible'}else {this.form['box1'].style.visibility='hidden'};">
<option value="">0</option>
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
</select>
<input style="visibility:hidden;" type="text" name="box"><input style="visibility:hidden;" type="text" name="box1">


can someone help me to do this.it's urgent.i'm stuck on this.

Re: Display two Textboxes on change of drop down list

Posted: Tue Jul 22, 2008 6:11 am
by eskio
hi,

why don't u use one text box <input style="visibility:hidden;" type="text" name="box"> instead of 2. And when u save the data, u can save to personal or to office according to the list box (select) value.