Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Show/Hide text and form field based on drop down selection

Thread Tools

Show/Hide text and form field based on drop down selection

Steve Speirs
Posts: n/a

I'm trying to show/hide a simple piece of text and a text field on a
form based on what choice is made from a drop down box.

<select name="dropdown" size="1">
<option selected value="">Please make a selection</option>
<option value="1">Choice 1</option>
<option value="2">Choice 2</option>
<option value="3">Choice 3</option>
<option value="4">Other</option>

i.e. if Choice 2 is selected I'd like to display a new <tr> with the

<td>New text field:</td>
<td><input name="newField" type="text size="20"></td>

if any other choices are made, I don't want to display anything.
I've tried several onchange() functions but can't achieve what I'm
looking for.

Any help would be appreciated,
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
1st Drop-down selection determins selected value in all drop-downs In ASP.Net Wizard jaysch ASP .Net 0 04-30-2011 02:19 PM
Automatic form field update based on previous form value selection Brett_A ASP General 8 04-19-2008 11:13 AM
Display row of Table Data based on Drop Down List Selection JamesW ASP .Net 0 09-10-2006 11:19 PM
update text field based on selection field Javascript 13 01-28-2005 05:09 PM
Changing drop-down field to text field. ehm Javascript 2 09-24-2003 07:00 PM