Results 1 to 2 of 2

Thread: Help validating check box

  1. #1
    Join Date
    Oct 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help validating check box

    So I'm trying to validate my check box, for it to say Please check the Terms & Conditions box if they click on enter site and they haven't clicked on the check box. And then if they do click the box and then enter site, it will direct them to my school's page...however, I can't seem to figure it out. Can anyone help?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Terms and Conditions</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"

    />
    <link rel="stylesheet" href="js_styles.css" type="text/css" />
    <script type="text/javascript">
    /* <![CDATA[ */
    function validateForm() {
    if (document.forms[0].yesBox[i].checked == false)
    {
    window.alert ("Please check the Terms & Conditions box.");
    return false;
    }
    else
    location.href = "http://www.frontrange.edu";
    }
    /* ]]> */
    </script>
    </head>
    <body>
    <h1>PLEASE READ THE FOLLOWING TERMS AND CONDITIONS (OTHERWISE NOTED AS THIS "AGREEMENT") CAREFULLY BEFORE USING THE SITES. BY USING THE SITES, YOU SIGNIFY YOUR ASSENT TO THIS AGREEMENT. IF YOU DO NOT ASSENT TO THIS AGREEMENT, YOU CANNOT VISIT THIS PAGE</h1>
    <form action="FormProcessor.html" method="get"
    enctype="application/x-www-form-urlencoded">
    <p>THE MATERIALS ON, OR ACCESSIBLE FROM, THE SITES ARE PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, WE DISCLAIMS ALL WARRANTIEs, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. WE DO NOT WARRANT THAT THE FUNCTIONS CONTAINED IN THE SITES WILL BE UNINTERRUPTED OR ERROR-FREE, THAT DEFECTS WILL BE CORRECTED, OR THAT THE SITES OR THE SERVERS THAT MAKE THE SITES AVAILABLE ARE FREE OF VIRUSES OR OTHER HARMFUL COMPONENTS. WE DO NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE, OR THE RESULTS OF THE USE, OF THE MATERIALS ON, OR ACCESSED THROUGH, THE SITES IN TERMS OF THEIR CORRECTNESS, ACCURACY, RELIABILITY, OR OTHERWISE. APPLICABLE LAW MAY NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY NOT
    APPLY TO YOU.</p>
    <h2>Have you read and understand the above terms and
    conditions?</h2>
    <p><input type="checkbox" name="yesBox" value="yes" />Yes<br /></p>
    <input type="button" value="Enter Site" onclick="validateForm();" />
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Oct 2008
    Posts
    40
    Thanks
    3
    Thanked 1 Time in 1 Post

    Smile

    function validateForm() {
    alert(document.forms[0].name);
    if (document.forms[0].yesBox.checked == false)
    {
    window.alert ("Please check the Terms & Conditions box.");
    return false;
    }
    else
    location.href = "http://www.frontrange.edu";
    }


    u can not take check box array because it is single..........

Bookmarks

Posting Permissions

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