You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Irfandhy Franciscus <en...@yahoo.com.sg> on 2004/04/28 16:04:50 UTC

Re: FW: FW: multiple validators and ActionErrors

Maybe youcan try saving your ActionErrors inside the request. And 
eveytime you validate a field, retrieve the ActionErrors from the 
request and append the message into the ActionErrors.

Sifuentes, Ben wrote:
> Another thing I do get back a list of errors for each failed field value per
> validator but, the issue is that each validator defined is returning a new
> ActionErrors per validator and not appending the previous errors already in
> the ActionErrors created by the previous validator. 
> 
> -----Original Message-----
> From: Sifuentes, Ben 
> Sent: Saturday, May 08, 2004 1:06 AM
> To: 'Struts Users Mailing List'
> Subject: RE: FW: multiple validators and ActionErrors
> 
> 
> Sorry, that was a cut and past error on my behalf it really is
> 
> <form-validation>
>     <formset>
> 
> 
> Again sorry for the confusion...
> 
> -Ben
> 
> -----Original Message-----
> From: Susan Bradeen [mailto:SusanB@softlanding.com]
> Sent: Friday, May 07, 2004 4:12 PM
> To: Struts Users Mailing List
> Subject: Re: FW: multiple validators and ActionErrors
> 
> 
> Ben, 
> 
> Theoretically, if every thing is working as is should, you get a list of 
> errors to display. One for each failed field value.  From a quick glance 
> at what you've provided below however, do you really have 
> 
> </form-validation>
>     </formset>
> 
> at the beginning of your validation.xml file? 
> 
> Susan Bradeen
> 
> "Sifuentes, Ben" <Be...@McKesson.com> wrote on 05/07/2004 09:42:46 
> AM:
> 
> 
>>Is this the correct behavior for the use with multiple validators?
>>
>>If so, is there away to configure it use the same ActionErrors for all
>>validators within a form?
>>
>>If this is not suppose to be happening can someone give a glue as what 
> 
> might
> 
>>be the problem here?
>>
>>Do I need to override the validate(...) method within the form to do
>>something like this to combine all the errors being generated by the
>>validators?
>>
>>
>>   ActionErrors errors = validate(....);
>>
>>
>>Any help would be appreciated.
>>
>>Thanks,
>>-Ben
>>
>>-----Original Message-----
>>From: Sifuentes, Ben [mailto:Ben.Sifuentes@McKesson.com]
>>Sent: Thursday, May 06, 2004 6:12 PM
>>To: Struts Users Mailing List (E-mail)
>>Subject: multiple validators and ActionErrors
>>
>>
>>
>>I'm using multiple validators for my form. I noticed by chance that each
>>validator is overwriting the ActionErrors for the previous validator 
> 
> that
> 
>>was run. Can someone tell me why this is happening and how to solve the
>>problem?
>>
>>Any help with the problem will be greatly appreciated.
>>
>>Below is the form-validation definition
>>====================================================================
>>
>></form-validation>
>>   </formset>
>>
>>      <form name="searchEmployeeForm">
>>
>>         <field property="lastName"
>>depends="validateEmployeeSearchFields">
>>            <arg0 name="validateEmployeeSearchFields"
>>key="search.valid.string.length"/>
>>         </field> 
>>
>>         <field property="dob"   depends="dateNotRequired">
>>               <arg0 key="search.dob"/>
>>            <var>
>>              <var-name>datePatternStrict</var-name>
>>              <var-value>MM/dd/yyyy</var-value>
>>            </var>
>>         </field>
>>
>>         <field property="ssn"
>>depends="validateEmployeeSearchSsn">
>>               <arg0 name="validateEmployeeSearchSsn"
>>key="search.ssn.short"/>
>>               <arg1 name="validateEmployeeSearchSsn"
>>key="search.employee.ssn.length"/>
>>               <arg2 name="validateEmployeeSearchSsn"
>>key="search.employee.ssn.delimiter"/>
>>         </field>
>>
>>
>>         <field property="hireDateFrom"
>>depends="validateFromDate">
>>               <arg0 key="search.employee.hire.date"/>
>>
>>            <var>
>>              <var-name>datePatternStrict</var-name>
>>              <var-value>MM/dd/yyyy</var-value>
>>            </var>
>>
>>         </field>
>>
>>         <field property="hireDateTo"
>>depends="validateToDate">
>>               <arg0 key="search.employee.hire.date"/>
>>
>>            <var>
>>              <var-name>datePatternStrict</var-name>
>>              <var-value>MM/dd/yyyy</var-value>
>>            </var>
>>
>>            <var>
>>              <var-name>fromDateProperty</var-name>
>>              <var-value>hireDateFrom</var-value>
>>            </var>
>>
>>         </field>
>>
>>         <field property="actionTypeDateFrom"
>>depends="validateFromDate">
>>               <arg0 key="search.employee.action.date"/>
>>
>>            <var>
>>              <var-name>datePatternStrict</var-name>
>>              <var-value>MM/dd/yyyy</var-value>
>>            </var>
>>
>>         </field>
>>
>>         <field property="actionTypeDateTo"
>>depends="validateToDate">
>>               <arg0 key="search.employee.action.date"/>
>>            <var>
>>              <var-name>datePatternStrict</var-name>
>>              <var-value>MM/dd/yyyy</var-value>
>>            </var>
>>            <var>
>>              <var-name>fromDateProperty</var-name>
>>              <var-value>actionTypeDateFrom</var-value>
>>            </var>
>>
>>         </field>
>>
>>      </form>
>>
>>    </formset>
>></form-validation>
>>
>>
>>---------------------------------------------------------------------
>>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
>>
> 
> 
> 
> ---------------------------------------------------------------------
> 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