help with javascript validation

Results 1 to 2 of 2

Thread: help with javascript validation

  1. #1
    Join Date
    Dec 1969

    Default help with javascript validation

    I have a form that has several text boxes and drop downs and I got the javascript validation to work for those fields. My javascript skills aren't that great and I've hit an impasse. I also have 5 checkboxes on that form with different names. The user needs to select at least 1 of those. I looked at several javascript sites but didn't find any code examples that would check for to see that the user selected at least 1 of those onSubmit. The code I wrote alerted for each checkbox that wasn't selected. LOL can anyone help out a javascript gimp?

  2. #2
    Join Date
    Dec 1969

    Default RE: help with javascript validation

    here you go:<BR><BR>this is the script:<BR>&#060;script language="JavaScript"&#062;<BR>var checkNum = 0;<BR><BR>function blah(obj)<BR> {<BR> if (obj.checked)<BR> checkNum++;<BR> else<BR> checkNum--;<BR> }<BR>&#060;/script&#062;<BR><BR>now on each checkbox add this:<BR>onClick="blah(this)"<BR><BR>and on your form check function see if "checkNum" is bigger than zero, if it is so the user checked one checkbox or more, if not, than he didn&#039;t

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts