SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form does not submit

    Hi Guys and Girls

    I don't generally use javascipt as I am a .net developer but can anyone help me with the following page

    <html>
    <head>
    <script language=javascript>
    function validate(chk){
    if (chk.checked == 1)
    document.Form1.submit();
    else
    alert("Please ensure you accept the terms & conditions")
    chk.focus();
    }
    </script>
    </head>
    <body>
    <form ID="Form1">
    <input type=checkbox name=chkterms ID="Checkbox1">Please Check Me
    <p><input type=button value="check" onclick="return validate(chkterms);" ID="Button1" NAME="Button1">
    </form>
    </body>
    </html>

    if the box is not checked I get the alert text if I leave box unchecked I get the error document.Form1 is null or not an object

    Can anyone help

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use document.getElementById("Form1") instead of document.Form1.
    Birnam wood is come to Dunsinane


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
  •