...

View Full Version : checkboxes



ClueLess
02-20-2003, 09:39 PM
Does anyone have any javascript or vbscript code that allow the user select one checkbox at the time...if the user select another checkbox then first one will be unchecked??? Thanks.

justame
02-21-2003, 12:17 AM
clu...
ummm whyyy just a rent® ya using 'radio' instead???

justame
02-21-2003, 12:20 AM
just a ps®...
/me just a found® thisss piece of 'coding' from jkd...:O)))
just a copied/pasted/saved/credited® (September 24, 2000 10:35:14 PM)...hehehe...



<form name="myform" action="bla">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
<input type="checkbox" name="checker">
</form>

<script>
<!--//
function validateIt() {
checkCount=0
for (i=0;i<=9;i++) {
if (document.myform.checker[i].checked) {
checkCount++
}
}
if (checkCount==6) {
document.forms.myform.submit()
}
else if (checkCount!=6) {
alert("You can only select 7 options.")
}
}
//-->
</script>

thattt just a lets® the viewer select '7' outta the 9...:O))) sooo mayyybe ya can just a lter® it to suit your needs???

ClueLess
02-21-2003, 01:14 AM
Thanks. I did use a Radio button...people here don't like it. They just want to make my life a bit miserable :)

ClueLess
02-21-2003, 01:17 AM
hahaha, it is NOT working. It lets me select all 10 checkboxes.

Skyzyx
02-21-2003, 02:04 AM
This should be what you're looking for.

justame
02-21-2003, 02:06 AM
clu...
just a sorrry® 'bout that...:O((( /me just a took® jkd's post for doing whattt it just a should® ...lol...hes just a one® of the bestest here in the forum...
'cept /me noticed ya just a said® ten...
hmmm...did ya just a try® deletin' one of these lines??? ...
<input type="checkbox" name="checker">

mayyybe thattts what just a caused® it NOT to work...:O(((

ClueLess
02-21-2003, 02:32 PM
Thanks, Skyzyx. Yes, that is what I am looking. BUT, your code is too dynamic. I am using a regular html code inside of a loop:

example:
<form name="test" action="submit">
<% for each ChildNode in ChildNodes%>
<input type="checkbox" name="avdelete">
<%next %>

</form>

ClueLess
02-21-2003, 02:33 PM
justame ......" hmmm...did ya just a try® deletin' one of these lines??? ... " YES, I want to delete one out of these lines

arnyinc
02-21-2003, 02:53 PM
<html>
<head>
<script>
<!--//
function uncheckOthers(checkedbox) {
for (i=0;i<=9;i++) {
if (checkedbox!=document.myform.checker[i])
document.myform.checker[i].checked=false;
}
}
//-->
</script>
</head>

<body>
<form name="myform" action="bla">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
<input type="checkbox" name="checker" onclick="uncheckOthers(this);">
</form>
</body>
</html>

ClueLess
02-21-2003, 03:07 PM
BIG THANKS! THAT'S IT!!!!

justame
02-21-2003, 03:59 PM
arn...
just a tas® for /mes 'newest' just a copied/pasted/credited/saved® text file...:O)))


sky...
just a tas® for yourrr solution tooo...:O)))
/me has it stored tooo incase someone is just a looking® for as clu said...just a dynamic® solution...:O)))



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum