The fact that you are getting 2 messages makes sense as you are running
validation against both the fields. It does not matter if the arg key is
the same. That would just pick the same message from your properties
file twice.

You could try using the validWhen validator and accociating that
validation with only one of the fields. Also, instead of using an arg
element in validator.xml, use an msg element to specify whatever message
you want to specify.

Or you could write your own validator, which is a bit much in this case.
I have pretty much the same thing at work here and I just use validWhen.

Harsh.

-----Original Message-----
From: Dinesh Mehra [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 24, 2006 1:47 PM
To: user@struts.apache.org
Subject: Validation help required


Hi,

I am using struts 1.1

I have two textboxes (username, password).
My requirements is
- I need to display a standard error message when both the fields are
empty
or when either of the field is empty.
- I need to display a different error message when both the the fields
are
filled but username-pwd do not match.

In validation.xml I declared two field properties each for username and
password with the same msg key but the problem is that when the form is
submitted with both the fields empty then the same error msg appears
twice.
How to rectify this situation.

Any kind of help would be highly appreciated.

Thanks.
Dinesh

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to