Faqts : Computers : Programming : Languages : Asp : ASP/VBScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 39 people (15%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How can I enable/disable a select box depending on variable value?

Apr 9th, 2003 12:05
dave lockard, William Hargrave,


I would use an IF statement. If you are good, you could use a case 
statement.
For example:
Start the page looking for a flag:
<html>
<%
flag = request.querystring="flag" 
 ' This is a variable to be sent from a form on
 ' a previous page.
IF flag = "" THEN
 flag = "0"
END IF
 ' Create a var if it is not passed.
 ' Now create the 'other' feature of your new form
IF flag ="0" then
 myVar = ""
ELSEIF flag = "1" then
 myVar = "checked"
END IF
%>
<form action="page.asp" method="POST">
 <input type="radio" value="yes" name="subscribe" <%=myVar%>>
 <input type="radio" value="no" name="subscribe">
</form>
</html>
This is a simple example of what I do frequently. Passing a variable 
from one page to another; This variable changes the way the second page 
looks, feels, or responds.
 dave



© 1999-2004 Synop Pty Ltd