Skip to content

Instantly share code, notes, and snippets.

@bg451
Created November 5, 2015 19:35
Show Gist options
  • Save bg451/89c87ac092592d03859d to your computer and use it in GitHub Desktop.
Save bg451/89c87ac092592d03859d to your computer and use it in GitHub Desktop.
function errorCheck(form) {\
if (form.firstName.value == "") {
errorReport("firstName", "is empty")
}
if (form.lastName.value == "") {
errorReport("lastName", "is empty")
}
var email_re = /[A-Z0-9._]+@[A-Z0-9.]+\.[A-Z]{2,}/
if (!email_re.exec(form.emailAddress.value)){
errorReport("emailAddress", 'is invalid')
}
var re = /\d\d\/\d\d\/\d\d\d\d/
if (!re.exec(form.dateOfBirth.value)) {
errorReport("dateOfBirth", 'is invalid')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment