You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Kent Tong <ke...@cpttm.org.mo> on 2007/02/05 12:04:11 UTC

T5: message key and validator type

Hi,

A validator uses its message key to lookup the error message. To
override it, we use the <field-id>-<validator-type> as the key
in the messages of the field's container. Why not standardize on 
the message key:

  <field-id>-<message-key>

or on the validator type?

--
Kent Tong
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)


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


Re: T5: message key and validator type

Posted by Howard Lewis Ship <hl...@gmail.com>.
There is a service configuration for adding additional bundles, but
there is no enforcement of the order. The configuration is not meant
for overriding existing messages (that's done in a component message
catalog), but instead is meant for adding new bundles from libraries
that add additional validator types.

On 2/5/07, Kent Tong <ke...@cpttm.org.mo> wrote:
> Kent Tong <kent <at> cpttm.org.mo> writes:
>
> >
> > Howard Lewis Ship <hlship <at> gmail.com> writes:
> >
> > > The developer will know the validator type, because they just
> > > specified it (either in a validate parameter, or with the  <at> Validate
> > > annotation).  They will not know, necesarilly, the message key used by
> > > the validator implementation.
>
> As they are not supposed to know the message keys, so there is
> no way for them to provide a global message bundle to override
> the validation messages?
>
> --
> Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: T5: message key and validator type

Posted by Kent Tong <ke...@cpttm.org.mo>.
Kent Tong <kent <at> cpttm.org.mo> writes:

> 
> Howard Lewis Ship <hlship <at> gmail.com> writes:
> 
> > The developer will know the validator type, because they just
> > specified it (either in a validate parameter, or with the  <at> Validate
> > annotation).  They will not know, necesarilly, the message key used by
> > the validator implementation.

As they are not supposed to know the message keys, so there is 
no way for them to provide a global message bundle to override 
the validation messages?

--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)


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


Re: T5: message key and validator type

Posted by Kent Tong <ke...@cpttm.org.mo>.
Howard Lewis Ship <hlship <at> gmail.com> writes:

> The developer will know the validator type, because they just
> specified it (either in a validate parameter, or with the  <at> Validate
> annotation).  They will not know, necesarilly, the message key used by
> the validator implementation.

OK. In my branch as we will work directly with validator objects,
there is no concept of validator type. I'd use the simple class 
name of the validator in its place. For the existing cases this 
is the same as the validator type.

--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)


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


Re: T5: message key and validator type

Posted by Howard Lewis Ship <hl...@gmail.com>.
The developer will know the validator type, because they just
specified it (either in a validate parameter, or with the @Validate
annotation).  They will not know, necesarilly, the message key used by
the validator implementation.

Further, different fields may have different messages for the same
validator, especially once we add back in a regexp-based validator. So
we need the flexibility to control, for a field-by-field basis, what
the message presented to the user will be.

On 2/5/07, Kent Tong <ke...@cpttm.org.mo> wrote:
> Hi,
>
> A validator uses its message key to lookup the error message. To
> override it, we use the <field-id>-<validator-type> as the key
> in the messages of the field's container. Why not standardize on
> the message key:
>
>   <field-id>-<message-key>
>
> or on the validator type?
>
> --
> Kent Tong
> Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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