charon
04-18-2003, 10:53 AM
Hi,
Due to I have a lot of forms which have same form fields most of the time, for instances:
form1:
Name
Ic
Sex,
Address
form2:
Name
Ic
Email
D.O.B
Contact_No
form3:
Name
Sex
Email
Passport
Occupation
Company
My question is How do I create a validation function which can apply to these three form's fields validation???? As you can see, there are fields in common for these forms->Name, Email, Ic and Sex.
Currently, my practise is, in order to prompt an error with alert message (Please enter your name, Invalid Name...etc), I create a validation function for these three forms respectively. I don't know it is a good practise or not, I'm now looking for better way of creating the validation function, so that there won't be redundancy.
Please advice!
Due to I have a lot of forms which have same form fields most of the time, for instances:
form1:
Name
Ic
Sex,
Address
form2:
Name
Ic
D.O.B
Contact_No
form3:
Name
Sex
Passport
Occupation
Company
My question is How do I create a validation function which can apply to these three form's fields validation???? As you can see, there are fields in common for these forms->Name, Email, Ic and Sex.
Currently, my practise is, in order to prompt an error with alert message (Please enter your name, Invalid Name...etc), I create a validation function for these three forms respectively. I don't know it is a good practise or not, I'm now looking for better way of creating the validation function, so that there won't be redundancy.
Please advice!