function checkComment() {
var msg = "";
if ((document.forms['comment'].name.value=='') || (document.forms['comment'].name.value=='Name'))
msg += "Enter a name\n";
if ((document.forms['comment'].message.value=='') || (document.forms['comment'].message.value=='Message'))
msg += "Enter a message\n";
if (msg == '') {
return true;
} else {
popup = "Please fix the following errors:\n\n" + msg;
alert(popup);
return false;
}
}
form check js not working
Started by tiki, Mar 20 2006 12:15 AM
2 replies to this topic
#1
Posted 20 March 2006 - 12:15 AM
Its not working and submits the data.
#2
Posted 20 March 2006 - 06:24 PM
Can you show us the form delcaration tag (the opening <form> tag and it's attributes)? You need to make sure you have an onSubmit attribute that would look something like: onSubmit="return checkComment();"
#3
Posted 21 March 2006 - 02:04 AM
It has that, but I instead switched to php checking, so never mind this!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
