struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@gmail.com>
Subject Re: validwhen returns is required error msg
Date Mon, 02 Jul 2007 15:05:41 GMT
On 7/2/07, Xavier Vanderstukken <xavan83@gmail.com> wrote:
> Thanks a lot :)
>
> Do you think this required a documentation update because I don't find your
> information here:
> http://struts.apache.org/1.3.8/faqs/validator.html

On that page it says:

"he default error message for a pluggable validator can be overriden
with the msg  element. So instead of using the msg  attribute for the
mask validator to generate the error message the msg  attribute from
the field will be used if the name of the field's name attribute
matches the validator's name attribute."

..but if you think its not clear enough, then improvments are always welcome :)

http://struts.apache.org/helping.html
http://svn.apache.org/viewvc/struts/struts1/trunk/src/site/xdoc/faqs/validator.xml

Niall

> 2007/7/2, Niall Pemberton <niall.pemberton@gmail.com>:
> >
> > On 7/2/07, Xavier Vanderstukken <xavan83@gmail.com> wrote:
> > > I have the following validation rule :
> > >
> > > <field property="newPasswordConfirm"
> > >                 depends="validwhen">
> > >                 <arg position="0" key="valid.confirmnewpassword"/>
> > >                 <var>
> > >                       <var-name>test</var-name>
> > >                       <var-value>(*this* == newPassword)</var-value>
> > >                 </var>
> > >         </field>
> > >
> > > In my ressource file:
> > > errors.required={0} is required.
> > > errors.invalid={0} is invalid.
> > > valid.confirmnewpassword=Confirm new password
> > >
> > > If I enter two differents values for newPasswordConfirm and newPassword
> > the
> > > error message displayed by html:errors tag is :
> > > Confirm new password is required instead of Confirm new password is
> > invalid.
> > >
> > > Am I doing something wrong?
> >
> > By default the "validwhen" validator uses the key "errors.required" -
> > if you want to use a different key for the message then you need to
> > specify it for the field using a <msg> element - something like
> >
> >    <msg name="validwhen" key="errors.invalid"/>
> >
> > Niall
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message