954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Form Validation - Multiple input field validation

I need to validate two forms containing multiple input fields but want just one error message if any of the fields are left blank, the page is required to submit the users details (registration form). Also if any of these fields are left blank i don't want to be able to go to the next page on clicking the submit button

E-AN
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

You should try the following:

- Add an id for every input and form
- Write a global function that checks the value (for example check_email(inputid) or check_name(inputid) )
- Use the event onsubmit() in each form tag. In that event you should call a fuction: onsubmit="return checkform(this.id)"

- The function checkform(formid) should return atrue if all fields have been entered correctly or false if not

~G

Graphix
Posting Pro in Training
432 posts since Aug 2009
Reputation Points: 82
Solved Threads: 74
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You