PDA

View Full Version : Form Field verify script has stopped working!!



Burgin
07-01-2010, 03:27 PM
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.


<!-- 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?

clueful
07-01-2010, 07:53 PM
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' );

Burgin
07-02-2010, 08:25 AM
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"?