That validation is useless:
Code:
function validate_number(field,alerttext){
with(field) {
var re = /[0-9]/g;
if(re.test(field.value)) { return true;}else{alert(alerttext);return false;}
}
}
That will *PASS* any field value that has even ONE digit in it!
So if the user enters "a%*(#)!4xyz" it will PASS because of the '4" in there.
A better test might be:
Code:
function validate_number(field,alerttext)
{
var re = /[^0-9]/;
if( ! re.test(field.value) ) return true;
alert(alerttext);
return false;
}
Which will barf if it finds *ANY* non-digit characters.
But that's not a good test for phone numbers, as people are used to putting in ( ) and - and . and maybe + into phone numbers.
So you should think more about what you really want to allow and really want to reject.
(Note that your test of the name field is likewise flawed. A name such as "!@#$$%^&()_+-=[]z1234567890" would be *accepted* because of the single "z" in there.)