View Full Version : Conditional form textarea

08-04-2006, 07:06 PM

Forgive me if this has already been answered. I couldn't find any reference to it.

I have an existing form built in ASP. 3 questions have drop-downs with the option of "other". If someone chooses "other", I want them to fill in a text area. However; if they do not chose "other", I don't want then to see the text area or at the very least, be able to fill in the text area. How can I use javascript to make it conditional in this manner?

Please be gentle as I am a newbie with the javascripting.

Thanks in advance,

08-04-2006, 07:48 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"



<select onchange="document.getElementById('fred').style.visibility=(this.selectedIndex==2)?'visible':'hidden';" >
<option>Option 0</option>
<option>Option 1</option>
<option>Option 2</option>
<textarea id="fred" rows="2" cols="50" style="visibility:hidden;" ></textarea>


08-04-2006, 08:52 PM
Thats it! Thank you so much!!