You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lucas Garcia <lu...@gmail.com> on 2007/06/21 18:04:11 UTC

[S2] short-circuit problem

Hi,

I'm working with 2.0.8 struts version, and I have a problem with the next
validation file:

 <validators>
 <field name="email">
  <field-validator type="requiredstring" short-circuit="true">
      <message key="Sign.error_required" />
  </field-validator>
  <field-validator type="email" short-circuit="true">
      <message key="Sign.error_email" />
  </field-validator>
 </field>
 <field name="password">
  <field-validator type="requiredstring" short-circuit="true">
   <param name="trim">true</param>
      <message key="Sign.error_required" />
  </field-validator>
 </field>
 <field name="passwordRep">
  <field-validator type="requiredstring" short-circuit="true">
   <param name="trim">true</param>
      <message key="Sign.error_required" />
  </field-validator>
  <field-validator type="fieldexpression" short-circuit="true">
   <param name="expression">(passwordRep == password)</param>
      <message key="Sign.error_passwords_not_equal" />
  </field-validator>
 </field>
</validators>


If I execute the form with the 3 fields (email, password and passwordRep) in
blank, 3 error messages are returned. I was reading that when a validation
short-circuited occurs, the next validations aren't executed. Nevertheless
-as I said- 3 error messages are returned.

What I'm doing wrong?

Thanks a lot in advance!

Re: [S2] short-circuit problem

Posted by Lucas Garcia <lu...@gmail.com>.
omg... As a lot of people says... rtfm, Lucas :)

That's correct, Dave :)

Thanks a lot for the appointment! ;)

Cheers!

On 6/21/07, Dave Newton <ne...@yahoo.com> wrote:
>
> --- Lucas Garcia <lu...@gmail.com> wrote:
> > If I execute the form with the 3 fields (email,
> > password and passwordRep) in blank, 3 error messages
>
> > are returned. I was reading that when a validation
> > short-circuited occurs, the next validations aren't
> > executed. Nevertheless -as I said- 3 error messages
> > are returned.
> >
> > What I'm doing wrong?
>
> From
> http://struts.apache.org/2.x/docs/validation.html:
>
> """
> Short cuircuiting and validator flavours
>
> A FieldValidator that gets short-circuited will only
> prevent other FieldValidators *for the same field*
> from being evaluated. [...]
> """
>
> (Emphasis mine.)
>
> d.
>
>
>
>
> ____________________________________________________________________________________Ready
> for the edge of your seat?
> Check out tonight's top picks on Yahoo! TV.
> http://tv.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: [S2] short-circuit problem

Posted by Dave Newton <ne...@yahoo.com>.
--- Lucas Garcia <lu...@gmail.com> wrote:
> If I execute the form with the 3 fields (email,
> password and passwordRep) in blank, 3 error messages

> are returned. I was reading that when a validation
> short-circuited occurs, the next validations aren't
> executed. Nevertheless -as I said- 3 error messages 
> are returned.
> 
> What I'm doing wrong?

From
http://struts.apache.org/2.x/docs/validation.html:

"""
Short cuircuiting and validator flavours

A FieldValidator that gets short-circuited will only
prevent other FieldValidators *for the same field*
from being evaluated. [...]
"""

(Emphasis mine.)

d.



       
____________________________________________________________________________________Ready for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV. 
http://tv.yahoo.com/

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