| Dynamic Form Inputs |
Description: These 3 functions in the code below allow anyone who does a lot of ASP work to create textboxes, checkboxes, and radio buttons dynamically without having to type the actual code. All you have to do is call the correct function, give it the input name, value, size, checked or not and you are set. Check it out.
<%@
LANGUAGE = "VBScript"
ENABLESESSIONSTATE = False
%>
<%
Function
cTextBox(name, value, size)
Response.Write"<input type=text
name='"&name&"' value='"&value&"'
size='"&size&"'>"&vbcrlf
Response.Write cTextBox("NAME", "1",
"12") &vbcrlf
End Function
Function
cCheckBox(name, value, checked)
Response.Write"<input type=checkbox
name='"&name&"' value='"&value&"'"
If
checked = 1 Then
Response.Write" CHECKED"
Response.Write">"
End Function
Function
cRadio(name, value, checked)
Response.Write"<input type=radio
name='"&name&"' value='"&value&"'"
If
checked = 1 Then
Response.Write" CHECKED"
Response.Write">"
End Function
%>
<html>
<body>
<%
'just declaring a couple of static variables here,
'but you can create cbname and cbvalue any way you like.
'use a recordset, or Request collection too:
cbname = "checkbox_name"
cbvalue = "act"
Response.Write "My Checkbox: "&cCheckBox(cbname, cbvalue,
1)&" "
'or, write a radio button like this:
Response.Write cRadio(cbname, cbvalue, 1)
%>
</body>
</html>