You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Raible, Matt" <Ma...@cable.comcast.com> on 2003/03/03 15:00:34 UTC

RE: Whoops! RE: ValidatorUtil.getActionError (RE: [Validator] Any one have a fields match rule?)

For a complete how-to on matching two fields, plus the JavaScript for
validator-rules.xml, check out http://tinyurl.com/6jnv.

HTH,

Matt

> -----Original Message-----
> From: Brian Topping [mailto:topping@digidemic.com]
> Sent: Saturday, March 01, 2003 6:41 PM
> To: Struts Users Mailing List
> Subject: Whoops! RE: ValidatorUtil.getActionError (RE: [Validator]
> Anyone have a fields match rule?)
> 
> 
> Whoops, found it!  
> 
> For those of you looking, the validateTwoFields example code 
> should be:
> 
>     public static boolean validateTwoFields(
>         Object bean,
>         ValidatorAction va,
>         Field field,
>         ActionErrors errors,
>         HttpServletRequest request,
>         ServletContext application) {
> 
>         String value = ValidatorUtil.getValueAsString(
>             bean,
>             field.getProperty());
>         String sProperty2 = field.getVarValue("secondProperty");
>         String value2 = ValidatorUtil.getValueAsString(
>             bean,
>             sProperty2);
> 
>         if (!GenericValidator.isBlankOrNull(value)) {
>            try {
>               if (!value.equals(value2)) {
>                  errors.add(field.getKey(),
>                          Resources.getActionError(request, 
> va, field));
> 
>                  return false;
>               }
>            } catch (Exception e) {
>                  errors.add(field.getKey(),
>                          Resources.getActionError(request, 
> va, field));
>                  return false;
>            }
>         }
> 
>         return true;
>     }
> }
> 
> -----Original Message-----
> From: Brian Topping 
> Sent: Saturday, March 01, 2003 5:09 PM
> To: Struts Users Mailing List
> Subject: ValidatorUtil.getActionError (RE: [Validator] Anyone have a
> fields match rule?)
> 
> 
> I'm trying to do this as well, but that code doesn't compile 
> any more.  I
> could override form.validate() and check there, but it would 
> be nice to keep
> everything clean.  I'm using the Validator nightly out of 
> commons, in the
> download process for the rest of the Struts tree.
> 
> My problem seems to be that ValidatorUtil.getActionError() 
> does not seem to
> exist, and if it was deprecated, I'm having problems finding 
> the method that
> it was deprecated in favor of.  
> 
> Anyone have info they could share?  thanks!
> 
> Brian
> 
> -----Original Message-----
> From: Giri Alwar [mailto:galwar@hotmail.com]
> Sent: Tuesday, January 21, 2003 3:15 PM
> To: Struts Users Mailing List
> Subject: Re: [Validator] Anyone have a fields match rule?
> 
> 
> Check out the "Comparing Two Fields" section in the link below:
> http://jakarta.apache.org/struts/userGuide/dev_validator.html
> 
> 
> ----- Original Message ----- 
> From: "James Higginbotham" <jh...@betweenmarkets.com>
> To: <st...@jakarta.apache.org>
> Sent: Tuesday, January 21, 2003 2:57 PM
> Subject: [Validator] Anyone have a fields match rule?
> 
> 
> Hi,
> 
> Anyone out there written the validator and Javascript for validating 2
> fields, say a password and confirm password, to ensure that 
> they match?
> I am using the Dec 12th CVS of Struts and related validation jars and
> haven't found anything yet. CVS diffs show that nothing new has been
> added to validation-rules.xml yet. Seems like a nice rule to have by
> default in Struts, since we all do lots of Create a New User 
> pages that
> often require a confirm of a password or email. I'm looking for both
> server and client validators, but will take what I can get ;)
> 
> Thanks,
> James
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.435 / Virus Database: 244 - Release Date: 12/31/2002
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


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