I asked the same question a few weeks. Ron Piterman
had kindly answered it.
You can check out the his answer at 

http://article.gmane.org/gmane.comp.java.tapestry.user/29260/match=shing

Basically, if you want to have ',' in your pattern,
you have to define your pattern in a bean.

<bean name="myPattern" ...

 <validators:required,minLength=10,$myPattern ...>

The $ sign notation is mentioned briefly in the
documentation : 

http://jakarta.apache.org/tapestry/UsersGuide/validation.html

Shing

--- Anders Jacobsson <[EMAIL PROTECTED]>
wrote:

> Hi!
> 
> I've been trying to do pattern validation using the
> new validator approach
> in Tapestry 4 (RC3) but it seems it is not possible
> to use [, ] and , in the
> pattern string. It seems like the
> constructValidatorList() method in
> ValidatorFactoryImpl cannot handle those kinds of
> characters and my guess is
> that it is due to that the same characters are used
> for message properties
> and separating validators, respectively. I get the
> following exception:
> 
> org.apache.hivemind.ApplicationRuntimeException
> Unable to parse
>
'required[%fieldRequired.error],pattern=^(?![0-9]{5,})[0-9a-zA-Z]{5,}$[%newPasswordInvalid.error]'
> into a list of validators.
> 
>    -
>   
>
org.apache.tapestry.form.validator.ValidatorFactoryImpl.constructValidatorList
>    (ValidatorFactoryImpl.java:67)
>    -
>
$ValidatorFactory_1087d0fd04d.constructValidatorList($ValidatorFactory_1087d0fd04d.java)
> 
>    -
>   
>
org.apache.tapestry.form.validator.ValidatorsBindingFactory.createBinding
>    (ValidatorsBindingFactory.java:39)
>    - ...
> 
> I am using annotations so my definition looks like
> this:
> 
> @Component(type = "TextField", bindings = {
> "hidden=true",
> "displayName=message:newPassword.field",
> "value=ognl:attributes.newPassword",
>
"validators=validators:required[%fieldRequired.error],pattern=^(?![0-9]{5,})[0-9a-zA-Z]{5,}$[%newPasswordInvalid.error]"
> })
> public abstract TextField getNewPassword();
> 
> I haven't tried without annotations but judging from
> the exception, I would
> probably get the same problem.
> 
> Is there any way to escape any 'sensitive'
> characters or is this a bug?
> 
> Cheers,
> Anders
> 


Home page :
  http://uk.geocities.com/matmsh/index.html


                
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to