• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validator..How to stop the validation after the first field?

 
Umar Hathab Abdullah
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have two text fields in my form. I am using the validator for the form validation.
What happens is that when I submit the form, I get the validation message for both the fields like " Name is required field,Password is required field".
Please write me how can I stop the validation so that I can display one one message.
Thanks,
Umar
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
377
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Umar,
You don't actually have to stop the validation. You just have to hide the messages. Instead of looping through the list of error messages, you can display the first one.
 
Umar Hathab Abdullah
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne,
But will you tell me how this is possible when doing the client side javascript validation.
I would also like to know how we can hide the messages both for server side and client side validations.
I am new to validator and I wud greatly appreciate the help.
Regards,
Umar
 
Rick Hightower
Author
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends how good you are at JavaScript. (I am not the greatest at it, but get by).
You can customize the JavaScript that gets output to the browswer.
Look inside validator-rules.xml file in your WEB-INF directory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic