You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Richard Frovarp <rf...@apache.org> on 2014/04/02 00:00:57 UTC

Regexp validation problem

This looks to be a bug, but I can't find any good documentation, so I 
thought I'd bring it here first.

I through a really quick and simple regexp together to validate time 
entries. It's goal was to be quick, and to verify that the values 
entered look like 24 hour time. 35:99 would validate, 5:5 wouldn't, and 
neither would 5:15 AM. I'm going to rework to be a bit more elegant in 
value checks. I was just surprised when it didn't parse.

The problem is using a range of values throws an exception. Looks like 
the code (5.3.7) is expecting a letter, and the 2nd value causes a parse 
error:

Render queue error in BeginRender[manage/CreateEvent:textfield_3]: 
Failure reading parameter 'validate' of component 
manage/CreateEvent:textfield_3: Unexpected character '2' at position 23 
of input string: required,regexp=^\d{1,2}:\d{2}$


Change the {1,2} to {2} or any other single value and it works.

Stack trace:
 
org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.parseError(FieldValidatorSourceImpl.java:423)
org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.parse(FieldValidatorSourceImpl.java:315)
org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.toValidatorSpecifications(FieldValidatorSourceImpl.java:200)
org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.createValidators(FieldValidatorSourceImpl.java:183)
org.apache.tapestry5.internal.bindings.ValidateBindingFactory$1.get(ValidateBindingFactory.java:64) 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Regexp validation problem

Posted by Howard Lewis Ship <hl...@gmail.com>.
Look in the documentation about moving the regexp out of the binding and
into the page's message catalog.


On Tue, Apr 1, 2014 at 3:00 PM, Richard Frovarp <rf...@apache.org> wrote:

> This looks to be a bug, but I can't find any good documentation, so I
> thought I'd bring it here first.
>
> I through a really quick and simple regexp together to validate time
> entries. It's goal was to be quick, and to verify that the values entered
> look like 24 hour time. 35:99 would validate, 5:5 wouldn't, and neither
> would 5:15 AM. I'm going to rework to be a bit more elegant in value
> checks. I was just surprised when it didn't parse.
>
> The problem is using a range of values throws an exception. Looks like the
> code (5.3.7) is expecting a letter, and the 2nd value causes a parse error:
>
> Render queue error in BeginRender[manage/CreateEvent:textfield_3]:
> Failure reading parameter 'validate' of component
> manage/CreateEvent:textfield_3: Unexpected character '2' at position 23
> of input string: required,regexp=^\d{1,2}:\d{2}$
>
>
> Change the {1,2} to {2} or any other single value and it works.
>
> Stack trace:
>
> org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.
> parseError(FieldValidatorSourceImpl.java:423)
> org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.parse(
> FieldValidatorSourceImpl.java:315)
> org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.
> toValidatorSpecifications(FieldValidatorSourceImpl.java:200)
> org.apache.tapestry5.internal.services.FieldValidatorSourceImpl.
> createValidators(FieldValidatorSourceImpl.java:183)
> org.apache.tapestry5.internal.bindings.ValidateBindingFactory$1.get(
> ValidateBindingFactory.java:64)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com