Revision: 17475
Updated Code
at September 6, 2009 20:59 by hotdiggity
Updated Code
<script type="text/javascript">
function validateForm (submit) {
var errmsg = "Oops, you're required to complete the following fields! \n";
if (submit.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
errmsg = errmsg + " - Valid email\n";
}
//Validate other form fields, etc, etc.
if (submit.name.value=="") {
errmsg = errmsg + " - Full Name\n";
}
//alert if fields are empty and cancel form submit
if (errmsg == "Oops, you're required to complete the following fields! \n") {
sub.submit();
}
else {
alert(errmsg);
return false;
}
Revision: 17474
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 6, 2009 20:48 by hotdiggity
Initial Code
<script type="text/javascript">
function validateForm (submit) {
var errmsg = "Oops, you're required to complete the following fields! \n";
if (submit.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
errmsg = errmsg + " - Valide email\n";
}
//Validate other form fields, etc, etc.
if (submit.name.value=="") {
errmsg = errmsg + " - Full Name\n";
}
//alert if fields are empty and cancel form submit
if (errmsg == "Oops, you're required to complete the following fields! \n") {
sub.submit();
}
else {
alert(errmsg);
return false;
}
Initial URL
Initial Description
<form> <input>
Initial Title
Javascript email validation
Initial Tags
email, javascript, validation
Initial Language
JavaScript