• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Validation of mandantory fields in struts

 
Greenhorn
Posts: 2
  • 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.
 
Ranch Hand
Posts: 4864
  • 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.
 
Ranch Hand
Posts: 42
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!