Javascript_dodo
12-17-2005, 08:21 PM
Hi,
I have a form which I have been scripting for validation , however I am unable to tab to any of the fields , I can only get to the next field by validating it.
Below is a snippet of the code.........
function validForm(myForm) {
var validChars=/^\s*([a-zA-Z]\s*)+$/;
re = /^\s*([a-zA-Z]\s*)+$/;
validChars=re.exec(myForm.fname.value)
if(!validChars) { alert("You must enter a valid Firstname");
myForm.fname.focus();
return false;
}
var validChars=/^\s*([a-zA-Z]\s*)+$/;
re = /^\s*([a-zA-Z]\s*)+$/;
validChars=re.exec(myForm.sname.value)
if(!validChars) { alert("You must enter a valid Surname");
myForm.sname.focus();
return false;
}
if (myForm.address.value == "") {
alert("You must enter your Address details");
myForm.address.focus();
return false;
}
and so on............
I have a form which I have been scripting for validation , however I am unable to tab to any of the fields , I can only get to the next field by validating it.
Below is a snippet of the code.........
function validForm(myForm) {
var validChars=/^\s*([a-zA-Z]\s*)+$/;
re = /^\s*([a-zA-Z]\s*)+$/;
validChars=re.exec(myForm.fname.value)
if(!validChars) { alert("You must enter a valid Firstname");
myForm.fname.focus();
return false;
}
var validChars=/^\s*([a-zA-Z]\s*)+$/;
re = /^\s*([a-zA-Z]\s*)+$/;
validChars=re.exec(myForm.sname.value)
if(!validChars) { alert("You must enter a valid Surname");
myForm.sname.focus();
return false;
}
if (myForm.address.value == "") {
alert("You must enter your Address details");
myForm.address.focus();
return false;
}
and so on............