You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hugo Palma <hu...@gmail.com> on 2007/04/02 13:16:05 UTC

Syntax for multiple validators

Hi all,

i would like to use two validators in a TextField where one of the validator
is defined as a bean in the page. I can't figure out the correct syntax to
use in the page spec for this. I've tried:

<binding name="validators" value="validators:required[%required-field]
bean:refmbValidator"/>

and

<binding name="validators" value="validators:required[%required-field],
bean:refmbValidator"/>

and lots others with no success...
Any ideas would be great.

Thanks....

Re: Syntax for multiple validators

Posted by Hugo Palma <hu...@gmail.com>.
That worked.

Thanks..

On 4/2/07, Sam Gendler <sg...@ideasculptor.com> wrote:
>
> My suspicion is that you can get a reference to the validator in Java
> code, , get a reference to the Bean in java code, then write a method
> that returns a collection containing both, and then call that method
> via ognl or prop and pass it to the validators binding.  I don't think
> you can combine bean and validator references the way you want to.
>
> --sam
>
>
> On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> > It's possible to inject page beans because the following works just
> fine:
> >
> > <binding name="validators" value="bean:refmbValidator"/>
> >
> > I just can't inject the required validator also.
> >
> > On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
> > >
> > > I think you can inject some also in the "validators" name binding
> syntax.
> > > Like you do for min/max validators and such.
> > > Don't know if it's possible to inject page beans as you would like.
> I'm
> > > curious too then :-)
> > >
> > > On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> > > >
> > > > I'm pretty sure i can use the bean directly without contributing it
> to
> > > the
> > > > application validators. I don't want to contribute because i want to
> > > > inject
> > > > some properties into the validator bean in the page descriptor.
> > > > I can assign each validator on it's own, i just can't assign both...
> > > >
> > > > On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
> > > > >
> > > > > You have to define your validators beans in the hivemodule
> tapestry
> > > > > contribution
> > > > >
> > > > >    <contribution configuration-id="
> > > tapestry.form.translator.Translators
> > > > ">
> > > > >         <bean name="myValidator" class="my.MyValidator" />
> > > > >    </contribution>
> > > > >
> > > > > Then you can use the bean name directly in the binding as you do
> with
> > > > > other
> > > > > tapestry default validators.
> > > > >
> > > > > On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> > > > > >
> > > > > > Hi all,
> > > > > >
> > > > > > i would like to use two validators in a TextField where one of
> the
> > > > > > validator
> > > > > > is defined as a bean in the page. I can't figure out the correct
> > > > syntax
> > > > > to
> > > > > > use in the page spec for this. I've tried:
> > > > > >
> > > > > > <binding name="validators"
> > > value="validators:required[%required-field]
> > > > > > bean:refmbValidator"/>
> > > > > >
> > > > > > and
> > > > > >
> > > > > > <binding name="validators"
> > > > value="validators:required[%required-field],
> > > > > > bean:refmbValidator"/>
> > > > > >
> > > > > > and lots others with no success...
> > > > > > Any ideas would be great.
> > > > > >
> > > > > > Thanks....
> > > > > >
> > > > >
> > > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Syntax for multiple validators

Posted by Sam Gendler <sg...@ideasculptor.com>.
My suspicion is that you can get a reference to the validator in Java
code, , get a reference to the Bean in java code, then write a method
that returns a collection containing both, and then call that method
via ognl or prop and pass it to the validators binding.  I don't think
you can combine bean and validator references the way you want to.

--sam


On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> It's possible to inject page beans because the following works just fine:
>
> <binding name="validators" value="bean:refmbValidator"/>
>
> I just can't inject the required validator also.
>
> On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
> >
> > I think you can inject some also in the "validators" name binding syntax.
> > Like you do for min/max validators and such.
> > Don't know if it's possible to inject page beans as you would like. I'm
> > curious too then :-)
> >
> > On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> > >
> > > I'm pretty sure i can use the bean directly without contributing it to
> > the
> > > application validators. I don't want to contribute because i want to
> > > inject
> > > some properties into the validator bean in the page descriptor.
> > > I can assign each validator on it's own, i just can't assign both...
> > >
> > > On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
> > > >
> > > > You have to define your validators beans in the hivemodule tapestry
> > > > contribution
> > > >
> > > >    <contribution configuration-id="
> > tapestry.form.translator.Translators
> > > ">
> > > >         <bean name="myValidator" class="my.MyValidator" />
> > > >    </contribution>
> > > >
> > > > Then you can use the bean name directly in the binding as you do with
> > > > other
> > > > tapestry default validators.
> > > >
> > > > On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> > > > >
> > > > > Hi all,
> > > > >
> > > > > i would like to use two validators in a TextField where one of the
> > > > > validator
> > > > > is defined as a bean in the page. I can't figure out the correct
> > > syntax
> > > > to
> > > > > use in the page spec for this. I've tried:
> > > > >
> > > > > <binding name="validators"
> > value="validators:required[%required-field]
> > > > > bean:refmbValidator"/>
> > > > >
> > > > > and
> > > > >
> > > > > <binding name="validators"
> > > value="validators:required[%required-field],
> > > > > bean:refmbValidator"/>
> > > > >
> > > > > and lots others with no success...
> > > > > Any ideas would be great.
> > > > >
> > > > > Thanks....
> > > > >
> > > >
> > >
> >
>

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


Re: Syntax for multiple validators

Posted by Hugo Palma <hu...@gmail.com>.
It's possible to inject page beans because the following works just fine:

<binding name="validators" value="bean:refmbValidator"/>

I just can't inject the required validator also.

On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
>
> I think you can inject some also in the "validators" name binding syntax.
> Like you do for min/max validators and such.
> Don't know if it's possible to inject page beans as you would like. I'm
> curious too then :-)
>
> On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> >
> > I'm pretty sure i can use the bean directly without contributing it to
> the
> > application validators. I don't want to contribute because i want to
> > inject
> > some properties into the validator bean in the page descriptor.
> > I can assign each validator on it's own, i just can't assign both...
> >
> > On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
> > >
> > > You have to define your validators beans in the hivemodule tapestry
> > > contribution
> > >
> > >    <contribution configuration-id="
> tapestry.form.translator.Translators
> > ">
> > >         <bean name="myValidator" class="my.MyValidator" />
> > >    </contribution>
> > >
> > > Then you can use the bean name directly in the binding as you do with
> > > other
> > > tapestry default validators.
> > >
> > > On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > i would like to use two validators in a TextField where one of the
> > > > validator
> > > > is defined as a bean in the page. I can't figure out the correct
> > syntax
> > > to
> > > > use in the page spec for this. I've tried:
> > > >
> > > > <binding name="validators"
> value="validators:required[%required-field]
> > > > bean:refmbValidator"/>
> > > >
> > > > and
> > > >
> > > > <binding name="validators"
> > value="validators:required[%required-field],
> > > > bean:refmbValidator"/>
> > > >
> > > > and lots others with no success...
> > > > Any ideas would be great.
> > > >
> > > > Thanks....
> > > >
> > >
> >
>

Re: Syntax for multiple validators

Posted by Martino Piccinato <ma...@gmail.com>.
I think you can inject some also in the "validators" name binding syntax.
Like you do for min/max validators and such.
Don't know if it's possible to inject page beans as you would like. I'm
curious too then :-)

On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
>
> I'm pretty sure i can use the bean directly without contributing it to the
> application validators. I don't want to contribute because i want to
> inject
> some properties into the validator bean in the page descriptor.
> I can assign each validator on it's own, i just can't assign both...
>
> On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
> >
> > You have to define your validators beans in the hivemodule tapestry
> > contribution
> >
> >    <contribution configuration-id="tapestry.form.translator.Translators
> ">
> >         <bean name="myValidator" class="my.MyValidator" />
> >    </contribution>
> >
> > Then you can use the bean name directly in the binding as you do with
> > other
> > tapestry default validators.
> >
> > On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> > >
> > > Hi all,
> > >
> > > i would like to use two validators in a TextField where one of the
> > > validator
> > > is defined as a bean in the page. I can't figure out the correct
> syntax
> > to
> > > use in the page spec for this. I've tried:
> > >
> > > <binding name="validators" value="validators:required[%required-field]
> > > bean:refmbValidator"/>
> > >
> > > and
> > >
> > > <binding name="validators"
> value="validators:required[%required-field],
> > > bean:refmbValidator"/>
> > >
> > > and lots others with no success...
> > > Any ideas would be great.
> > >
> > > Thanks....
> > >
> >
>

Re: Syntax for multiple validators

Posted by Hugo Palma <hu...@gmail.com>.
I'm pretty sure i can use the bean directly without contributing it to the
application validators. I don't want to contribute because i want to inject
some properties into the validator bean in the page descriptor.
I can assign each validator on it's own, i just can't assign both...

On 4/2/07, Martino Piccinato <ma...@gmail.com> wrote:
>
> You have to define your validators beans in the hivemodule tapestry
> contribution
>
>    <contribution configuration-id="tapestry.form.translator.Translators">
>         <bean name="myValidator" class="my.MyValidator" />
>    </contribution>
>
> Then you can use the bean name directly in the binding as you do with
> other
> tapestry default validators.
>
> On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
> >
> > Hi all,
> >
> > i would like to use two validators in a TextField where one of the
> > validator
> > is defined as a bean in the page. I can't figure out the correct syntax
> to
> > use in the page spec for this. I've tried:
> >
> > <binding name="validators" value="validators:required[%required-field]
> > bean:refmbValidator"/>
> >
> > and
> >
> > <binding name="validators" value="validators:required[%required-field],
> > bean:refmbValidator"/>
> >
> > and lots others with no success...
> > Any ideas would be great.
> >
> > Thanks....
> >
>

Re: Syntax for multiple validators

Posted by Martino Piccinato <ma...@gmail.com>.
You have to define your validators beans in the hivemodule tapestry
contribution

   <contribution configuration-id="tapestry.form.translator.Translators">
        <bean name="myValidator" class="my.MyValidator" />
   </contribution>

Then you can use the bean name directly in the binding as you do with other
tapestry default validators.

On 4/2/07, Hugo Palma <hu...@gmail.com> wrote:
>
> Hi all,
>
> i would like to use two validators in a TextField where one of the
> validator
> is defined as a bean in the page. I can't figure out the correct syntax to
> use in the page spec for this. I've tried:
>
> <binding name="validators" value="validators:required[%required-field]
> bean:refmbValidator"/>
>
> and
>
> <binding name="validators" value="validators:required[%required-field],
> bean:refmbValidator"/>
>
> and lots others with no success...
> Any ideas would be great.
>
> Thanks....
>