Dropdown box - نوشته شده در (1142 Views)
Starting Member
Fromafarr
مطلب: 7
7
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.<
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Forum Moderator
AnonJr
مطلب: 5768
5768
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<
نوشته شده در
Advanced Member
Carefree
مطلب: 4224
4224
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>"
%>
<
 
شما باید یک متن وارد کنید