You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Tabuenca <dt...@gmail.com> on 2006/11/17 04:09:06 UTC

Dynamic Validator Parameters

   This may be a very easy question, but I've looked around and can't
find the right way to do this. All I want to be able to do is set a
validator parameter like "max" for example to the value of a page
property instead of a hard-coded number. So I kinda want to do like
"max=ognl:maxValue". What's the right way to do this?

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


Re: Dynamic Validator Parameters

Posted by Daniel Tabuenca <dt...@gmail.com>.
This would work for custom validators. What I want to know is how can
I bind values to the standard validators such as specifying the
maximum length of a string or the max value of an integer using
existing validators but just get the actual numeric constraint from a
property rather than hard-coding it. In my opinion there should be
some notation within the validators: prefix (similar to using $ for
referring to beans) but that refers to an ognl expression or at the
very least a simple property name. I just wanted to make sure there is
no standard easy way of doing this before I go and write my own
validator.


On 11/17/06, Christian Dutaret <cd...@gmail.com> wrote:
> Actually it is validators=validators:$maxBean
>
> Then in your bean's validate(...), you can access any page property that
> way:
>
> YourPage page = (YourPage) field.getPage();
> YourPropertyType value = page.getYourProperty();
>
> 2006/11/17, Jesse Kuhnert <jk...@gmail.com>:
> >
> > Define the max validator class as a bean and reference it instead of
> > max=<?>
> > (ie validators="validators:maxBean" i think, maybe it's more complicated
> > than that)
> >
> > On 11/16/06, Daniel Tabuenca <dt...@gmail.com> wrote:
> > >
> > >    This may be a very easy question, but I've looked around and can't
> > > find the right way to do this. All I want to be able to do is set a
> > > validator parameter like "max" for example to the value of a page
> > > property instead of a hard-coded number. So I kinda want to do like
> > > "max=ognl:maxValue". What's the right way to do this?
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo/(and a dash of TestNG), team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
> >
> >
>
>

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


Re: Dynamic Validator Parameters

Posted by Christian Dutaret <cd...@gmail.com>.
Actually it is validators=validators:$maxBean

Then in your bean's validate(...), you can access any page property that
way:

YourPage page = (YourPage) field.getPage();
YourPropertyType value = page.getYourProperty();

2006/11/17, Jesse Kuhnert <jk...@gmail.com>:
>
> Define the max validator class as a bean and reference it instead of
> max=<?>
> (ie validators="validators:maxBean" i think, maybe it's more complicated
> than that)
>
> On 11/16/06, Daniel Tabuenca <dt...@gmail.com> wrote:
> >
> >    This may be a very easy question, but I've looked around and can't
> > find the right way to do this. All I want to be able to do is set a
> > validator parameter like "max" for example to the value of a page
> > property instead of a hard-coded number. So I kinda want to do like
> > "max=ognl:maxValue". What's the right way to do this?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo/(and a dash of TestNG), team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
>

Re: Dynamic Validator Parameters

Posted by Jesse Kuhnert <jk...@gmail.com>.
Define the max validator class as a bean and reference it instead of max=<?>
(ie validators="validators:maxBean" i think, maybe it's more complicated
than that)

On 11/16/06, Daniel Tabuenca <dt...@gmail.com> wrote:
>
>    This may be a very easy question, but I've looked around and can't
> find the right way to do this. All I want to be able to do is set a
> validator parameter like "max" for example to the value of a page
> property instead of a hard-coded number. So I kinda want to do like
> "max=ognl:maxValue". What's the right way to do this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com