I wondered if there was a way to implement validation on form fields with something like stylesheets.
So you could say...
<INPUT TYPE=TEXT NAME=EmployeeName onChange="return validate_me();">
<INPUT TYPE=RADIO NAME=Gender VALUE=http://www.webdeveloper.com/forum/archive/index.php/Male onClick="return validate_me();">
<INPUT TYPE=RADIO NAME=Gender VALUE=Female onClick="return validate_me();">
The function validate_me() would then be able to work out somehow the correct validation routine to use. I don't know if it should use CLASS or is there another way to do it?
My aim is that when I create a new form, all I have to do is define the <INPUT> fields, and include the .js file at the top of the page.
EDIT: It would be even better if I could use onSubmit() in the <FORM> tag to call the validation function. This could then loop through the form's elements and carry out the necessary validation routine.
So you could say...
<INPUT TYPE=TEXT NAME=EmployeeName onChange="return validate_me();">
<INPUT TYPE=RADIO NAME=Gender VALUE=http://www.webdeveloper.com/forum/archive/index.php/Male onClick="return validate_me();">
<INPUT TYPE=RADIO NAME=Gender VALUE=Female onClick="return validate_me();">
The function validate_me() would then be able to work out somehow the correct validation routine to use. I don't know if it should use CLASS or is there another way to do it?
My aim is that when I create a new form, all I have to do is define the <INPUT> fields, and include the .js file at the top of the page.
EDIT: It would be even better if I could use onSubmit() in the <FORM> tag to call the validation function. This could then loop through the form's elements and carry out the necessary validation routine.