If your calling that script from the OnSubmit function of your form tag,
simply return FALSE to the call:


<FORM ACTION="" ACTION PAGE" NAME="myFORM" > anyCheck('myForm')>

Then in the script:
if (eval("document.registration.type_no[" + idx + "].checked") == true)
{
    total += 1;
if (total >1) alert("You cannot select more than 1 registration type");
return false
   }
}
return true

This is of course you need no other validation

-----Original Message-----
From: Tim Laureska [mailto:[EMAIL PROTECTED]
Sent: Friday, April 09, 2004 8:52 AM
To: CF-Talk
Subject: JS help - checkboxes

I have a little script that throws up an alert when more than 1 checkbox
is selected.  However, is there some code I can put in this script that
will also prevent anything else in the cold fusion page from processing
until the "more than one" checkbox problem is corrected?  Here's the
script:

<SCRIPT LANGUAGE="_javascript_">
<!-- Begin
function anyCheck(form) {
var total = 0;
var max = form.type_no.length;
for (var idx = 0; idx < max; idx++) {
if (eval("document.registration.type_no[" + idx + "].checked") == true)
{
    total += 1;
if (total >1) alert("You cannot select more than 1 registration type");
   }
}

}
//  End -->
</script>

TIA
Tim
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to