You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Guillaume Bodet <gb...@financeactive.com> on 2012/03/27 12:47:37 UTC
Remote validator
Hi all,
I'm working on implementing a remote validator for T 5.3.
The remote validator should perform an ajax call to the field's container component to check wether the value is valid, and have the same behavior as other client-side validations.
Here is what I did :
- extend AbstractValidator to create a RemoteValidator class
- extend JS Validators (providing a "remote" validator that performs the ajax call and throw the appropriate message if invalid)
- contribute ValidatorSource to add my validator
The overall design seems allright but I have a problem accessing the field's container component inside the validator.
The render method of the Validator only provides access to the Field and FormSupport interfaces. None on them gives me a handle to the ComponentResources. Hence, I cannot create the link to the component event handler method that should be called via ajax.
Is there any way to access a field container component or ComponentResources from inside a validator class?
Best regards
Guillaume
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Remote validator
Posted by Guillaume Bodet <gb...@financeactive.com>.
It just works!
Thanks Thiago (and so sorry not to have figured it out by myself ;;)
Regards
Guillaume
Le 27 mars 2012 à 14:46, Thiago H. de Paula Figueiredo a écrit :
> On Tue, 27 Mar 2012 07:47:37 -0300, Guillaume Bodet <gb...@financeactive.com> wrote:
>
>> Hi all,
>
> Hi!
>
>> Is there any way to access a field container component or ComponentResources from inside a validator class?
>
> Have you tried casting the Field parameter to Component?
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Remote validator
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 27 Mar 2012 07:47:37 -0300, Guillaume Bodet
<gb...@financeactive.com> wrote:
> Hi all,
Hi!
> Is there any way to access a field container component or
> ComponentResources from inside a validator class?
Have you tried casting the Field parameter to Component?
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org