You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Steven Coco <co...@stevencoco.com> on 2007/06/14 20:26:29 UTC
T5: (Noob:) How To Contribute A Custom Validator
I'm REALLY swimming lost here, however I want to use a custom Validator for a
form Select widget.
I have the server side down OK. I figured I would try to attach the validator
in the template as well --
t:validator="NotEnumElementValidator=UNSELECTED" -- but I don't know how to
contribute the validator so I can use it here.
I'm trying obvious things like in my ApplicationModule class:
public static Validator<...> build();
and
public static NotEnumElementValidator buildNotEnumElementValidator();
But no luck trying! I can't find the concrete example in the documentation.
Can anyone tell me how I'm supposed to do this?
--About this validator too: it is supposed to take an Enum element that is an
invalid selection from a list: I use the old rogue method of having the first
item in the Select list say something like "[You must select...]" and then
test if the user has chosen some other item. Is this still a modern method of
validating a Select element?
This kind of validator seems like it would be a nice fit with the Bean edit
form, which seems to support enums too.
Anyway, thanks in advance.
Ciao.
Steev Coco.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: (Noob:) How To Contribute A Custom Validator
Posted by Siddhartha Argollo <sl...@tre-ba.gov.br>.
How I did it:
public static void
contributeFieldValidatorSource(MappedConfiguration<String, Validator>
configuration)
{
configuration.add("myvalidator", new MyValidator());
}
Steven Coco wrote:
> I'm REALLY swimming lost here, however I want to use a custom Validator for a
> form Select widget.
>
> I have the server side down OK. I figured I would try to attach the validator
> in the template as well --
> t:validator="NotEnumElementValidator=UNSELECTED" -- but I don't know how to
> contribute the validator so I can use it here.
>
> I'm trying obvious things like in my ApplicationModule class:
>
> public static Validator<...> build();
>
> and
>
> public static NotEnumElementValidator buildNotEnumElementValidator();
>
> But no luck trying! I can't find the concrete example in the documentation.
> Can anyone tell me how I'm supposed to do this?
>
> --About this validator too: it is supposed to take an Enum element that is an
> invalid selection from a list: I use the old rogue method of having the first
> item in the Select list say something like "[You must select...]" and then
> test if the user has chosen some other item. Is this still a modern method of
> validating a Select element?
>
> This kind of validator seems like it would be a nice fit with the Bean edit
> form, which seems to support enums too.
>
> Anyway, thanks in advance.
>
> Ciao.
> Steev Coco.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Siddhartha Argollo
Técnico Judiciário
TRE-BA
slargollo@tre-ba.gov.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org