You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lionel Touati <l....@expediacorporate.fr> on 2007/06/13 08:22:38 UTC

Re: Setting a message for Identity Validator

Hi List,

There is no way AFAIK to specify a different message to be displayed for 
the Identity validator.
For example, when using the following format 
match=password[%user_general_info_ERR12], it does not pickup the 
specified message.
 
When looking at the code the Identity class looks for the message in the 
_identityMessage field which does not seem be settable. So I've modified 
the code this way the Identity class to get the message properly


    protected String buildIdentityMessage(ValidationMessages messages, 
IFormComponent field, IFormComponent referent)
    {
        Object[] parameters = new Object[]{
                field.getDisplayName(), new Integer(_matchType), 
referent.getDisplayName()
        };
        if(_identityMessage!=null) {
          return messages.formatValidationMessage(_identityMessage,
                  ValidationStrings.INVALID_FIELD_EQUALITY, parameters);
        } else {
          return messages.formatValidationMessage(getMessage(),
                  ValidationStrings.INVALID_FIELD_EQUALITY, parameters);
        }
    }

Tell me if this is the right way to do it, or if I miss something

Thanks




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


Re: Setting a message for Identity Validator

Posted by Andreas Andreou <an...@di.uoa.gr>.
fixed

On 6/14/07, Jesse Kuhnert <jk...@gmail.com> wrote:
>
> That looks mostly reasonable,  though I've never really seen this identity
> validator before.
>
> Is there someone else who'd be able to patch things up?
>
> On 6/13/07, Lionel Touati <l....@expediacorporate.fr> wrote:
> >
> > Hi List,
> >
> > There is no way AFAIK to specify a different message to be displayed for
> > the Identity validator.
> > For example, when using the following format
> > match=password[%user_general_info_ERR12], it does not pickup the
> > specified message.
> >
> > When looking at the code the Identity class looks for the message in the
> > _identityMessage field which does not seem be settable. So I've modified
> > the code this way the Identity class to get the message properly
> >
> >
> >     protected String buildIdentityMessage(ValidationMessages messages,
> > IFormComponent field, IFormComponent referent)
> >     {
> >         Object[] parameters = new Object[]{
> >                 field.getDisplayName(), new Integer(_matchType),
> > referent.getDisplayName()
> >         };
> >         if(_identityMessage!=null) {
> >           return messages.formatValidationMessage(_identityMessage,
> >                   ValidationStrings.INVALID_FIELD_EQUALITY, parameters);
> >         } else {
> >           return messages.formatValidationMessage(getMessage(),
> >                   ValidationStrings.INVALID_FIELD_EQUALITY, parameters);
> >         }
> >     }
> >
> > Tell me if this is the right way to do it, or if I miss something
> >
> > Thanks
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>



-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

Re: Setting a message for Identity Validator

Posted by Jesse Kuhnert <jk...@gmail.com>.
That looks mostly reasonable,  though I've never really seen this identity
validator before.

Is there someone else who'd be able to patch things up?

On 6/13/07, Lionel Touati <l....@expediacorporate.fr> wrote:
>
> Hi List,
>
> There is no way AFAIK to specify a different message to be displayed for
> the Identity validator.
> For example, when using the following format
> match=password[%user_general_info_ERR12], it does not pickup the
> specified message.
>
> When looking at the code the Identity class looks for the message in the
> _identityMessage field which does not seem be settable. So I've modified
> the code this way the Identity class to get the message properly
>
>
>     protected String buildIdentityMessage(ValidationMessages messages,
> IFormComponent field, IFormComponent referent)
>     {
>         Object[] parameters = new Object[]{
>                 field.getDisplayName(), new Integer(_matchType),
> referent.getDisplayName()
>         };
>         if(_identityMessage!=null) {
>           return messages.formatValidationMessage(_identityMessage,
>                   ValidationStrings.INVALID_FIELD_EQUALITY, parameters);
>         } else {
>           return messages.formatValidationMessage(getMessage(),
>                   ValidationStrings.INVALID_FIELD_EQUALITY, parameters);
>         }
>     }
>
> Tell me if this is the right way to do it, or if I miss something
>
> Thanks
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

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