You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephan Windmüller <st...@tu-dortmund.de> on 2014/09/04 13:33:31 UTC

Global validator for text inputs

Hello,

our web application suffers from many users who enter non-printable
characters like Unicode 200E:

http://en.wikipedia.org/wiki/Left-to-right_mark

We already have code which is able to detect all unwanted characters. Is
it possible to write a global validator which is added automatically to
each textfield or textarea component?

Regards
 Stephan

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


Re: Global validator for text inputs

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
On 05.09.2014, Lance Java wrote:

> You could create a mixin which uses @BindParameter to set the "validate"
> parameter on the Field.
> 
> You could then create a ComponentClassTransformWorker2 which attaches the
> mixin to TextField and TextArea by default.

Thanks for the suggestion, I will have a look at the blog post!

Regards
 Stephan

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


Re: Global validator for text inputs

Posted by Lance Java <la...@googlemail.com>.
You could create a mixin which uses @BindParameter to set the "validate"
parameter on the Field.

You could then create a ComponentClassTransformWorker2 which attaches the
mixin to TextField and TextArea by default.

See the blog post here for a similar pattern:
http://tawus.wordpress.com/2011/08/01/tapestry-mixins-classtransformations/

I'm hoping you won't hit a variation of this issue:
https://issues.apache.org/jira/browse/TAP5-2099

Re: Global validator for text inputs

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
On 04.09.2014 um 14:03, Muhammad Gelbana wrote:

>> We already have code which is able to detect all unwanted
>> characters. Is it possible to write a global validator which is
>> added automatically to each textfield or textarea component?
> Check if these pages have an answer to your question
> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/contributingvalidators
> http://tapestry.apache.org/forms-and-validation.html#FormsandValidation-ValidationMacros

Thanks for the reply! The second link looks interesting, but that does
not cover textfields which have currently no associated validator.

Regards
 Stephan

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


Re: Global validator for text inputs

Posted by Muhammad Gelbana <m....@gmail.com>.
Check if these pages have an answer to your question

http://jumpstart.doublenegative.com.au/jumpstart/examples/input/contributingvalidators
http://tapestry.apache.org/forms-and-validation.html#FormsandValidation-ValidationMacros

*---------------------*
*Muhammad Gelbana*
http://www.linkedin.com/in/mgelbana


On Thu, Sep 4, 2014 at 2:33 PM, Stephan Windmüller <
stephan.windmueller@tu-dortmund.de> wrote:

> Hello,
>
> our web application suffers from many users who enter non-printable
> characters like Unicode 200E:
>
> http://en.wikipedia.org/wiki/Left-to-right_mark
>
> We already have code which is able to detect all unwanted characters. Is
> it possible to write a global validator which is added automatically to
> each textfield or textarea component?
>
> Regards
>  Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>