RE: REPOST - and why using 'label' with checkboxes
by Klaas De Waele <klaas(at)grace.be>
|
| Date: |
Wed, 19 Feb 2003 08:59:39 +0100 |
| To: |
"'cbirds'" <cbirds(at)earthlink.net>, HWG <hwg-techniques(at)mail.hwg.org> |
| |
todo: View
Thread,
Original
|
|
I'm not using any javascript in there. Just pure ASP. See the entire code
at the bottom - you can just copy and paste, set filename to default.asp and
put it on a server somewhere. (Although I did put out the code to the screen
when you use the example.) You can even experiment with getting rid of the
ID tags - I don't care.
Oh - just one more thing and that's those label tags. I started using them
some time ago because they actually are, in my eyes, required for
userfriendliness. By putting a label and setting the "for" attribute to the
ID of the checkbox, you also make that text a clickable reference to the
box. Try that example again I put online http://www.grace.be/tests/form and
click on the text next to a checkbox. This simulates how most OS's treat
checkboxes and I think we should all start using those label tags NOW. ;)
Unless someone will tell us they're not HTML compliant?
- Kayjey -
www.fiatcoupe.net
---- save below as default.asp and try it on an ASP webserver
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Klaas De Waele">
<meta name="keywords" content="form, test, comma, seperated, checkbox,
values">
<meta name="description" content="Test for forms - checkboxes with same name
return comma seperated value list.">
<title>form test</title>
</head>
<body>
<p>
<%
if request.form("submit") = "try it out" AND request.form("justabox") <> ""
then
response.write "You have checked the following boxes:<br>"
response.write request.form("justabox")
response.write "<br><br>"
end if
%>
<form method="post" action="default.asp" name="aform">
<input type="checkbox" name="justabox" ID="1" value="one"> <label
for="1">one</label><br>
<input type="checkbox" name="justabox" ID="2" value="two"> <label
for="2">two</label><br>
<input type="checkbox" name="justabox" ID="3" value="three"> <label
for="3">three</label><br>
<input type="checkbox" name="justabox" ID="4" value="four"> <label
for="4">four</label><br>
<br>
<input type="submit" value="try it out" name="submit">
</form>
<%
if request.form("submit") = "try it out" AND request.form("justabox") <> ""
then
%>
<br><u>ASP CODE USED</u><br>
<pre>
if request.form("submit") = "try it out" AND request.form("justabox") <> ""
then
response.write "You have checked the following boxes:<br>"
response.write request.form("justabox")
response.write "<br><br>"
end if
</pre>
<%
end if
%>
</p>
</body>
</html>
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.