GeeCON Prague 2014*
The moose likes Struts and the fly likes Validation of mandantory fields in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validation of mandantory fields in struts" Watch "Validation of mandantory fields in struts" New topic
Author

Validation of mandantory fields in struts

A.afg81in
Greenhorn

Joined: Jan 09, 2006
Posts: 2
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Daniel Platon
Ranch Hand

Joined: Oct 10, 2005
Posts: 42
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
 
wood burning stoves
 
subject: Validation of mandantory fields in struts