pop up text area after click yes from drop down list

W

weiwei

Hi all
I want to write a asp script, basically, that has drop down box in the
form, if user select Yes,
on the same page, a hidden textarea will show up, if user select No,
then nothing happen.
so far, my code is unsuccessful, in addition, I also got syntax error
on the response.write line
anyone has idea, please help me out, I would really appreciate your
help

below is my current code


<form name="form1" method="post" action="test13.asp">

<select name="test">
<option value=""></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>

<%strtest = request("test")%>
<%
If strtest = "Yes" Then
response.write "<textarea name="whatis" cols="50"></textarea>"
Else

End if
%>

</form>
 
W

William Morris

ASP is server side technology. What you want is client-side script, like
javascript or client-side vb script. The best way to handle it is to put
the textbox inside a hidden <div> tag, then in the OnChange event for the
select box, check for the value you want and un-hide the div. Like so:

<form name="form1" method="post" action="test13.asp">

<select name="test" onChange="if (document.form1.test.options[1].selected)
{document.hiddenDiv.style.display=''} else
{document.hiddenDiv.style.display='none'} ">
<option value=""></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>

<div style="display: none" name="hiddenDiv">
<textarea name="whatis" cols="50"></textarea>
</div>

You might want to address any further questions like this to a client-size
scripting group.
 
W

weiwei

thank you very much
William Morris said:
ASP is server side technology. What you want is client-side script, like
javascript or client-side vb script. The best way to handle it is to put
the textbox inside a hidden <div> tag, then in the OnChange event for the
select box, check for the value you want and un-hide the div. Like so:

<form name="form1" method="post" action="test13.asp">

<select name="test" onChange="if (document.form1.test.options[1].selected)
{document.hiddenDiv.style.display=''} else
{document.hiddenDiv.style.display='none'} ">
<option value=""></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>

<div style="display: none" name="hiddenDiv">
<textarea name="whatis" cols="50"></textarea>
</div>

You might want to address any further questions like this to a client-size
scripting group.


weiwei said:
Hi all
I want to write a asp script, basically, that has drop down box in the
form, if user select Yes,
on the same page, a hidden textarea will show up, if user select No,
then nothing happen.
so far, my code is unsuccessful, in addition, I also got syntax error
on the response.write line
anyone has idea, please help me out, I would really appreciate your
help

below is my current code


<form name="form1" method="post" action="test13.asp">

<select name="test">
<option value=""></option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>

<%strtest = request("test")%>
<%
If strtest = "Yes" Then
response.write "<textarea name="whatis" cols="50"></textarea>"
Else

End if
%>

</form>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top