This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Struts and the fly likes how do u show multiple validation errors at once struts 1.2.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how do u show multiple validation errors at once struts 1.2.4" Watch "how do u show multiple validation errors at once struts 1.2.4" New topic
Author

how do u show multiple validation errors at once struts 1.2.4

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
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
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5287
    
  10

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do u show multiple validation errors at once struts 1.2.4