...

View Full Version : Conditional form textarea



anessa05
08-04-2006, 07:06 PM
Hi!

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,
Anessa

vwphillips
08-04-2006, 07:48 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
</head>

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

</html>

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum