You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Onno Scheffers <on...@piraya.nl> on 2009/01/26 03:03:00 UTC

Non-default custom String-Translator?

 Is there a way I can setup a custom String validator that is only added to
fields I explicitly set the translator for?

I want to make sure some TextFields (username and email-address) are
converted to lowercase Strings. I figured a Translator would be useful for
that. But when I create a LowercaseTranslator using the name 'lowercase' all
TextFields in the application seem to use the LowercaseTranslator all of a
sudden.

This is how I contributed my Translator:

   public static void contributeTranslatorSource(Configuration<Translator>
configuration) {
      configuration.add(new LowercaseTranslator());
   }

regards,

Onno

Re: Non-default custom String-Translator?

Posted by Onno Scheffers <on...@piraya.nl>.
> Sorry, I mean @Translate("lowercase")

Is that a new annotation in Tapestry 5.1? I am using Tapestry 5.0.18 which
doesn't seem to contain an annotation called Translate?

regards,

Onno



On Sat, Jan 31, 2009 at 4:41 AM, Howard Lewis Ship <hl...@gmail.com> wrote:

> Sorry, I mean @Translate("lowercase")
>
> On Fri, Jan 30, 2009 at 2:30 PM, Onno Scheffers <on...@piraya.nl> wrote:
> >>
> >> How about defining a "lowercase" translator, and using
> >> @Validate("lowercase") on those fields?
> >
> >
> >
> > Hi Howard,
> >
> > thanks for your response.
> >
> > I didn't know it was possible to use translator-names as arguments to the
> > Validate annotation.
> > Do I still have to contribute the translator in some way or is it enough
> to
> > just add it to the translators sub-package?
> >
> > I did try it without contributing and although I don't get any errors on
> the
> > page, the user-input is not converted to lower-case and if I do
> contribute
> > it, _all_ string-fields are converted to lower-case.
> >
> > regards,
> >
> > Onno
> >
> >
> >
> >
> >> >  Is there a way I can setup a custom String validator that is only
> added
> >> to
> >> > fields I explicitly set the translator for?
> >> >
> >> > I want to make sure some TextFields (username and email-address) are
> >> > converted to lowercase Strings. I figured a Translator would be useful
> >> for
> >> > that. But when I create a LowercaseTranslator using the name
> 'lowercase'
> >> all
> >> > TextFields in the application seem to use the LowercaseTranslator all
> of
> >> a
> >> > sudden.
> >> >
> >> > This is how I contributed my Translator:
> >> >
> >> >   public static void
> contributeTranslatorSource(Configuration<Translator>
> >> > configuration) {
> >> >      configuration.add(new LowercaseTranslator());
> >> >   }
> >> >
> >> > regards,
> >> >
> >> > Onno
> >> >
> >>
> >>
> >>
> >> --
> >> Howard M. Lewis Ship
> >>
> >> Creator Apache Tapestry and Apache HiveMind
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Non-default custom String-Translator?

Posted by Howard Lewis Ship <hl...@gmail.com>.
Sorry, I mean @Translate("lowercase")

On Fri, Jan 30, 2009 at 2:30 PM, Onno Scheffers <on...@piraya.nl> wrote:
>>
>> How about defining a "lowercase" translator, and using
>> @Validate("lowercase") on those fields?
>
>
>
> Hi Howard,
>
> thanks for your response.
>
> I didn't know it was possible to use translator-names as arguments to the
> Validate annotation.
> Do I still have to contribute the translator in some way or is it enough to
> just add it to the translators sub-package?
>
> I did try it without contributing and although I don't get any errors on the
> page, the user-input is not converted to lower-case and if I do contribute
> it, _all_ string-fields are converted to lower-case.
>
> regards,
>
> Onno
>
>
>
>
>> >  Is there a way I can setup a custom String validator that is only added
>> to
>> > fields I explicitly set the translator for?
>> >
>> > I want to make sure some TextFields (username and email-address) are
>> > converted to lowercase Strings. I figured a Translator would be useful
>> for
>> > that. But when I create a LowercaseTranslator using the name 'lowercase'
>> all
>> > TextFields in the application seem to use the LowercaseTranslator all of
>> a
>> > sudden.
>> >
>> > This is how I contributed my Translator:
>> >
>> >   public static void contributeTranslatorSource(Configuration<Translator>
>> > configuration) {
>> >      configuration.add(new LowercaseTranslator());
>> >   }
>> >
>> > regards,
>> >
>> > Onno
>> >
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: Non-default custom String-Translator?

Posted by Onno Scheffers <on...@piraya.nl>.
>
> How about defining a "lowercase" translator, and using
> @Validate("lowercase") on those fields?



Hi Howard,

thanks for your response.

I didn't know it was possible to use translator-names as arguments to the
Validate annotation.
Do I still have to contribute the translator in some way or is it enough to
just add it to the translators sub-package?

I did try it without contributing and although I don't get any errors on the
page, the user-input is not converted to lower-case and if I do contribute
it, _all_ string-fields are converted to lower-case.

regards,

Onno




> >  Is there a way I can setup a custom String validator that is only added
> to
> > fields I explicitly set the translator for?
> >
> > I want to make sure some TextFields (username and email-address) are
> > converted to lowercase Strings. I figured a Translator would be useful
> for
> > that. But when I create a LowercaseTranslator using the name 'lowercase'
> all
> > TextFields in the application seem to use the LowercaseTranslator all of
> a
> > sudden.
> >
> > This is how I contributed my Translator:
> >
> >   public static void contributeTranslatorSource(Configuration<Translator>
> > configuration) {
> >      configuration.add(new LowercaseTranslator());
> >   }
> >
> > regards,
> >
> > Onno
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Non-default custom String-Translator?

Posted by Howard Lewis Ship <hl...@gmail.com>.
How about defining a "lowercase" translator, and using
@Validate("lowercase") on those fields?

On Sun, Jan 25, 2009 at 6:03 PM, Onno Scheffers <on...@piraya.nl> wrote:
>  Is there a way I can setup a custom String validator that is only added to
> fields I explicitly set the translator for?
>
> I want to make sure some TextFields (username and email-address) are
> converted to lowercase Strings. I figured a Translator would be useful for
> that. But when I create a LowercaseTranslator using the name 'lowercase' all
> TextFields in the application seem to use the LowercaseTranslator all of a
> sudden.
>
> This is how I contributed my Translator:
>
>   public static void contributeTranslatorSource(Configuration<Translator>
> configuration) {
>      configuration.add(new LowercaseTranslator());
>   }
>
> regards,
>
> Onno
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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