Dropdown box

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/68204?pagenum=1
05 November 2025, 14:46

Topic


Fromafarr
Dropdown box
09 February 2009, 05:23


Hi, I have a form with a checkbox and a dropdown box. If the checkbox is not selected i need to make sure that the dropdown box is NOT selected or rather that the value is returned to empty. Any help appreciated.<

 

Replies ...


AnonJr
09 February 2009, 06:33


First, you're going to need to use some JavaScript to do that. Second, you're more likely to get a good answer from Google and/or http://stackoverflow.com<
Carefree
11 February 2009, 02:34


Originally posted by Fromafarr
Hi, I have a form with a checkbox and a dropdown box. If the checkbox is not selected i need to make sure that the dropdown box is NOT selected or rather that the value is returned to empty. Any help appreciated.
Something like this? Save the following as "selecttype.asp".
Code:

<%
if Request.Form("Method_Type")="Select" then
if Request.Form("Checkbox_Var") = "" then
DropDown_Var=""
else
DropDown_Var=Request.Form("DropDown_Var")
end if
Response.Write "<center>DropDown_Var="&DropDown_var&"</center><br> "
end if

Response.Write "<table align=""center"" border=""0"" width=""40%"" cellspacing=""0"" cellpadding=""0"">" & vbNewline & _
" <form action=""selecttype.asp"" method=""post"" name=""SelectType"">" & vbNewline & _
" <input type=""hidden"" name=""Method_Type"" value=""Select"">" & vbNewline & _
" <tr valign=""middle"">" & vbNewLine & _
" <td bgcolor=""cyan"">" & vbNewline & _
" <table align=""center"" border=""1"" width=""100%"" cellspacing=""1"" cellpadding=""4"">" & vbNewline & _
" <tr valign=""middle"">" & vbNewLine & _
" <td colspan=""2"" align=""center"" width=""100%"" bgcolor=""lightgreen"">" & vbNewline & _
" <font color=""darkgreen"" size=""4""><b>Double Selector</b> " & vbNewline & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" width=""50%"" bgcolor=""lightgrey"">" & vbNewline & _
" <font size=""2"">" & vbNewLine & _
" <input type=""checkbox"" name=""Checkbox_Var"" value=""1""><b>On/Off</b> " & vbNewLine & _
" </input>" & vbNewline & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" width=""50%"" bgcolor=""lightgrey"">" & vbNewline & _
" <font size=""2"">" & vbNewLine & _
" <select name=""Dropdown_Var"" size=""1"">" & vbNewline & _
" <option value=""1st Value"">1st Value</option>" & vbNewLine & _
" <option value=""2nd Value"">2nd Value</option>" & vbNewLine & _
" <option value=""3rd Value"">3rd Value</option>" & vbNewLine & _
" </select>" & vbNewline & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" width=""100%"" colspan=""2"">" & vbNewLine & _
" <input type=""submit"" value=""submit"" id=""submit"">" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </form>" & vbNewLine & _
"</table>"
%>
<
© 2000-2021 Snitz™ Communications