0

Hi all

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

and

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..

Thanks..

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by javaAddict
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.