Results 1 to 3 of 3

Thread: Form Field verify script has stopped working!!

  1. #1
    Join Date
    Jan 2006
    Location
    Derbyshire, UK
    Posts
    74
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default Form Field verify script has stopped working!!

    Here's my form page...
    http://www.nawt.net/assets/captcha/example.html and here's the external script that works well on other forms but not on this form.

    Code:
    <!-- Begin
    function checkFields() {
    missinginfo = "";
    if (document.myForm.fname.value == "") {
    missinginfo += "\n     -  Name";
    }
    if ((document.myForm.email.value == "") || 
    (document.myForm.email.value.indexOf('@') == -1) || 
    (document.myForm.email.value.indexOf('.') == -1)) {
    missinginfo += "\n     -  Email address";
    }
    if(document.myForm.subject.value == "") {
    missinginfo += "\n     -  Business name";
    }
    
    if (missinginfo != "") {
    missinginfo ="\n" +
    "You didn't correctly enter your:\n" +
    missinginfo + "\n_____________________________" +
    "\nPlease re-enter and submit again!";
    alert(missinginfo);
    return false;
    }
    else return true;
    }
    //  End -->
    Can anyone see why it doesn't work?

  2. #2
    Join Date
    Jul 2008
    Posts
    128
    Thanks
    0
    Thanked 17 Times in 16 Posts

    Default

    Can anyone see why it doesn't work?
    They can if they bother to use the error console.

    document.myForm addresses a form with a name 'myForm', not an ID. Use: document.getElementById( 'myForm' );

  3. #3
    Join Date
    Jan 2006
    Location
    Derbyshire, UK
    Posts
    74
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Default

    document.myForm addresses a form with a name 'myForm', not an ID. Use: document.getElementById( 'myForm' );

    Thanks for that but...

    Is there a difference between the above method and adding the name="myForm" to the form?

    Also what's the "error console"?

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
  •