You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Stewart Cambridge <st...@gmail.com> on 2005/10/13 19:16:16 UTC

[validator] Validating ALL fields

Dear All,

In using the commons validator (with Struts) I am finding that it stop
at the first failure.

Is there any way (apart from extending the current framework with my
own checks) to have it continue validating so that a set of failing
fields can be returned?

Many thanks,

Stewart

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


Re: [validator] Validating ALL fields

Posted by Stewart Cambridge <st...@gmail.com>.
Thank you for the tip Niall.
I'm not sure if the "extends" Validator is right for me, as what I'm doing is:
I have an ArrayList of beans (using your LazyValidatorForm) and the
beans are implmenting an interface I called "DynamicallyValidatable"
which declares one method: getValidationRuleName() which returns a
"depends" String of validation rules, and then I have a custom
validation method which calls this, retrieves the appropriate
ValidationAction object from the framework and invokes it.

What I would like to see is the stopOnFirstError="false" struts plugin
setting a property in the validator as well as on the javascript. I
may just do this myself, but it won't be before November...

Stewart

PS Do you think "dynamic validation" of indexed properties is a
feature that would be wanted by more than just myself?


On 15/10/05, Niall Pemberton <ni...@blueyonder.co.uk> wrote:
> The short answer is there isn't a way besides customizing validator - as you
> indicated on the struts list thats the approach you took:
>
> http://www.mail-archive.com/user%40struts.apache.org/msg35473.html
>
> If you want an alternative "hack" - then I wrote an "extends" validator
> which resolves this issue. The only downside is you can't use javascript
> validation with it - but in the case of "indexed" properties, javascript
> validation isn't supported anyway. You can find/download it here:
>
> http://www.niallp.pwp.blueyonder.co.uk/strutsvalidatorextends.html
>
> Niall
>
> ----- Original Message -----
> From: "Stewart Cambridge" <st...@gmail.com>
> Sent: Thursday, October 13, 2005 10:10 PM
>
>
> I already have "stopOnFirstError" set.
> Apparently it this is for the javascript validation.
> How do I get it to work on the server side?
>
> I'm using a List-backed Form, by the way.
> ie:
> <html:text property="propList[0].beanProp"/>
> <html:text property="propList[1].beanProp"/>
> etc
>
> where the form has an ArrayList of beans
>
> Thank you for your suggestion,
>
> Stewart
>
> On 13/10/05, Angelo Luis <an...@gmail.com> wrote:
> > in your struts-config.xml
> >
> > put this
> >
> > <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> > <set-property property="pathnames" value="/WEB-INF/validator-rules.xml
> > ,/WEB-INF/validations.xml"/>
> > <set-property property="stopOnFirstError" value="false"/>
> > </plug-in>
> >
> > On 10/13/05, Stewart Cambridge <st...@gmail.com> wrote:
> > >
> > > Dear All,
> > >
> > > In using the commons validator (with Struts) I am finding that it stop
> > > at the first failure.
> > >
> > > Is there any way (apart from extending the current framework with my
> > > own checks) to have it continue validating so that a set of failing
> > > fields can be returned?
> > >
> > > Many thanks,
> > >
> > > Stewart
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

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


Re: [validator] Validating ALL fields

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
The short answer is there isn't a way besides customizing validator - as you
indicated on the struts list thats the approach you took:

http://www.mail-archive.com/user%40struts.apache.org/msg35473.html

If you want an alternative "hack" - then I wrote an "extends" validator
which resolves this issue. The only downside is you can't use javascript
validation with it - but in the case of "indexed" properties, javascript
validation isn't supported anyway. You can find/download it here:

http://www.niallp.pwp.blueyonder.co.uk/strutsvalidatorextends.html

Niall

----- Original Message ----- 
From: "Stewart Cambridge" <st...@gmail.com>
Sent: Thursday, October 13, 2005 10:10 PM


I already have "stopOnFirstError" set.
Apparently it this is for the javascript validation.
How do I get it to work on the server side?

I'm using a List-backed Form, by the way.
ie:
<html:text property="propList[0].beanProp"/>
<html:text property="propList[1].beanProp"/>
etc

where the form has an ArrayList of beans

Thank you for your suggestion,

Stewart

On 13/10/05, Angelo Luis <an...@gmail.com> wrote:
> in your struts-config.xml
>
> put this
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml
> ,/WEB-INF/validations.xml"/>
> <set-property property="stopOnFirstError" value="false"/>
> </plug-in>
>
> On 10/13/05, Stewart Cambridge <st...@gmail.com> wrote:
> >
> > Dear All,
> >
> > In using the commons validator (with Struts) I am finding that it stop
> > at the first failure.
> >
> > Is there any way (apart from extending the current framework with my
> > own checks) to have it continue validating so that a set of failing
> > fields can be returned?
> >
> > Many thanks,
> >
> > Stewart



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


Re: [validator] Validating ALL fields

Posted by Stewart Cambridge <st...@gmail.com>.
I already have "stopOnFirstError" set.
Apparently it this is for the javascript validation.
How do I get it to work on the server side?

I'm using a List-backed Form, by the way.
ie:
<html:text property="propList[0].beanProp"/>
<html:text property="propList[1].beanProp"/>
etc

where the form has an ArrayList of beans

Thank you for your suggestion,

Stewart

On 13/10/05, Angelo Luis <an...@gmail.com> wrote:
> in your struts-config.xml
>
> put this
>
> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml
> ,/WEB-INF/validations.xml"/>
> <set-property property="stopOnFirstError" value="false"/>
> </plug-in>
>
> On 10/13/05, Stewart Cambridge <st...@gmail.com> wrote:
> >
> > Dear All,
> >
> > In using the commons validator (with Struts) I am finding that it stop
> > at the first failure.
> >
> > Is there any way (apart from extending the current framework with my
> > own checks) to have it continue validating so that a set of failing
> > fields can be returned?
> >
> > Many thanks,
> >
> > Stewart
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
>
>

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


Re: [validator] Validating ALL fields

Posted by Angelo Luis <an...@gmail.com>.
in your struts-config.xml

put this

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml
,/WEB-INF/validations.xml"/>
<set-property property="stopOnFirstError" value="false"/>
</plug-in>

On 10/13/05, Stewart Cambridge <st...@gmail.com> wrote:
>
> Dear All,
>
> In using the commons validator (with Struts) I am finding that it stop
> at the first failure.
>
> Is there any way (apart from extending the current framework with my
> own checks) to have it continue validating so that a set of failing
> fields can be returned?
>
> Many thanks,
>
> Stewart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>