• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how do u show multiple validation errors at once struts 1.2.4

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following in validation.xml

<field
property="email"
depends="required,email">
<arg0 key="registration.email"/>
</field>

the following in the ApplicationResources.properties

errors.required={0} is required.
errors.email={0} is an invalid e-mail address.

registration.email= Email

I was wondering how would I show both the required and the email at once rather than the required first and once that is corrected the email error is displayed

thank you for your time
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could define two separate validations instead of combining both in one.

<field
property="email"
depends="required">
<arg0 key="registration.email"/>
</field>
<field
property="email"
depends="email">
<arg0 key="registration.email"/>
</field>

The question is, what's the point? It doesn't make much sense to me to show them both. If the user doesn't provide a required email address, then of course it is invalid. IMO, the errors messages should be mutually exclusive: if one is shown, the other one shouldn't.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic