-->
//Initialise error message to a null string
var errmsg="";
function formValidator(_mmm){
// Make quick references to our fields
var firstname = document.getElementById('first_name');
var lastname = document.getElementById('last_name');
var email = document.getElementById('email');
var phone = document.getElementById('phone');
// Check each input in the order that it appears in the form!
//Each call to the functions returns true or false and is stored in x
isAlphabet(firstname, "Please enter only letters for your First Name")
isAlphabet(lastname, "Please enter only letters for your Last Name")
isNumeric(phone, "Please enter only numbers for your Phone Number")
//If errmsg is empty string then all tests were passed so send the email
if (errmsg==""){
return true;
}
//One or more tests failed so display error message
alert(errmsg)
//Reset error message - needed or subsequent tries extends it
errmsg=""
return false;
}
//This routine not used - checks for empty field
function isEmpty(elem, helperMsg){
if(elem.value.length == 0){
alert(helperMsg);
elem.focus(); // set the focus to this input
return true;
}
return false;
}
//This routine checks whether field is numeric
function isNumeric(elem, helperMsg){
var numericExpression = /^[0-9]+$/;
if(elem.value.match(numericExpression)){
return true;
}else{
errmsg=errmsg + helperMsg +"\n"
//alert(helperMsg);
//elem.focus();
return false;
}
}
//Checks whether field contain only alpha chars
function isAlphabet(elem, helperMsg){
var alphaExp = /^[a-zA-Z+'+-]+$/;
if(elem.value.match(alphaExp)){
return true;
}else{
errmsg=errmsg + helperMsg +"\n"
//alert(helperMsg);
//elem.focus();
return false;
}
}
//This routine checks whether field contains only alpha and numberic
function isAlphanumeric(elem, helperMsg){
var alphaExp = /^[0-9a-zA-Z]+$/;
if(elem.value.match(alphaExp)){
return true;
}else{
alert(helperMsg);
elem.focus();
return false;
}
}
//This routine checks for valid email address syntax
function emailValidator(elem, helperMsg){
var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
if(elem.value.match(emailExp)){
return true;
}else{
errmsg=errmsg + helperMsg +"\n"
//alert(helperMsg);
//elem.focus();
return false;
}
}
Contact Us
To request information please complete send the following information by text whilst we update our forms
- Your name
- The best time to call
- The type of lessons sought (automatic or manual)
Thank you for your understanding whilst we update our site.