Hi all

On my jsp page i m having two tables..
first table have 14 rows which takes input type=text.


my second table is having 9 rows which also takes 9 inputs.

Thus total 23 inputs on a form..
Now when the user click submit, i want to check if total of 20 inputs are fill or less than that..
Means user can input max 20 inputs from both the tables..

plz reply for such validation..


Two ways:

First: Use javascript: Instead of type="submit", use:
<input type="button" value="Button" onclick="someMethod()"/>
Inside the someMethod you can check the length of the inputs in order to see how many were given ans act accordingly: submit the form or print an error message with the alert() function.

Second (Not as good as the first): Submit the from and when you get the values of the inputs use java to check their length. Then if you don't have enough inputs you redirect to the previous page in order for the user to give the right inputs.

Finally, I would suggest that you make your question to a javascript forum