File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation of mandantory fields in struts

 
A.afg81in
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have some of the mandantory fields on my page. I want to show only one message "Please enter all mandantory fields (Mandantory fields are indicated by *)", if any of the required field is not entered. How can I achive this using struts validator framework. Please reply ASAP.

thank & Regards,
A.afg81in.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The struts validation framework is designed to produce one error message per error. You could have each validation produce the same error message, but in a case where more than one field is blank, the message will be repeated more than one time.

There may be a way to go in and change the way validation works to accommodate your desire for a single error message, but in my opinion, it isn't worth the effort. A simple javaScript function that you write would be a much easier way to accomplish this.
 
Daniel Platon
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all...

Another way to achieve what you want is using a boolean variable in your form's validate() method, something like:


Hope this helps,

Dan
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic