Validation of Checkboxes

Results 1 to 2 of 2

Thread: Validation of Checkboxes

  1. #1
    Dan White Guest

    Default Validation of Checkboxes

    How can I validate checkboxes? I have tried using this bit of code, but it doesn&#039t appear to do anything:<BR><BR>&#060;script language="Javascript"&#062;<BR> <BR>function secondCheck () {<BR>var firstCheckbox = window.document.Form.Fieldname <BR>var firstRadioButton = window.document.Form.Fieldname2<BR> <BR>if (firstCheckbox.checked == false)<BR>{ alert ("You must check at least one of the What industries do you target? field")<BR>return false; }<BR> <BR>if (firstRadioButton.checked == false)<BR>{ alert ("You must pick one option from the Subscribe to Cable and Wireless News for Consultants and IT Professionals? field")<BR>return false; }<BR> <BR>else<BR>{ return true; }<BR>}<BR> <BR>&#060;/script&#062;<BR><BR>Any ideas? I want to be able to validate radio buttons as well. I can write in VBScript, but not in JavaScript.<BR><BR>Dan

  2. #2
    Join Date
    Dec 1969

    Default RE: Validation of Checkboxes

    check this out.<BR><BR>window.document.form.radioname[].checked==true<BR>the [] indicate the number for which radio with the same name, order from top to bottom

Posting Permissions

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