Problem:
Suppose an OA page has three fields:RollNo, Name, Rank and a Submit button.
The form requires the following validations:
1) RollNo should be an integer
2) Name should be a string
3) Rank should be an integer.
When Submit button is clicked, the code in the controller is called. Here we first check the value in RollNo field, throw an Exception if it has an invalid value. Then we verify the Name field and throw an OAException, if an invalid Name is entered and lastly we validate the Rank field for invalid entry.
Suppose the user has entered wrong value into all of the fields. When he/she clicks on Submit button, then first the error message related to the RollNo field is displayed ("RollNo has to be an integer. Please enter an integer in the RollNo field.") The user enters an integer to the RollNo field and hits on Submit.
Again he sees the error related to the name field ("Name has to be a valid String. Please enter characters only into the Name field") He does accordingly and hit submit for another time.
Another error message is displayed. This time, it is related to the Rank field on the OA page.
Instead of making the user hit Submit three times, is there a way in which we can display all the error messages in one go?!
Solution:
Thanks to Manoj.. Or Should I say, Lalith :-)
I found the solution to the problem.Will post it soon! :-)
No comments:
Post a Comment