You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rudolf Baloun <Ru...@atron.de> on 2006/01/27 12:23:38 UTC

How to set ValidationMessages in T4.0?

Hi,
i got this code in my *.page:

<bean name="dateTranslator" 
class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
<component id="inputBirthday" type="TextField">
        <binding name="displayName" 
value="ognl:page.messagesUtil.birthdayMsg"/>
        <binding name="validators" value="validators:required"/>
        <binding name="translator" value="ognl:beans.dateTranslator"/>
        <binding name="value" value="ognl:pageBean.customer.ado.birthday"/>
</component>

I want to add use another validationmessage as the default message.
how can i set the validationmessage?

<binding name="validators" value="validators:required, message=This is 
my message"/> doesnt work!?

Anyone knows how to set the message?

best regards

Rudolf B.




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


Re: How to set ValidationMessages in T4.0?

Posted by Rudolf Baloun <Ru...@atron.de>.
I found a solution:

 <bean name="dateTranslator" class="my.package.LenientDateTranslator">
        <set name="pattern">"dd.MM.yyyy"</set>
        <set name="message" value="ognl:page.wrongDateMessage"/>
 </bean>

In one line it doesn't work (for me)?!



Rudolf Baloun wrote:

> I found the solution in the api:
> <bean name="dateTranslator" 
> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy,message=Date 
> Wrong"/>
> but can´t use an ognl expression like this:
>
> <bean name="dateTranslator" 
> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy,message=ognl:page.wrongDateMessage"/> 
>
>
> is there a solution for my problem?
>
> best regards
>
> Rudolf B.
>
>
>
> Rudolf Baloun wrote:
>
>> Nice,
>>
>> i can set the message for the "required" - field with your solution.
>> But i want to set the message for wrong Data-Input.
>> My code again:
>>
>> <bean name="dateTranslator" 
>> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
>> <component id="inputBirthday" type="TextField">
>> <binding name="displayName" value="ognl:page.messagesUtil.birthdayMsg"/>
>> <binding name="validators" value="validators:required"/>
>> <binding name="translator" value="ognl:beans.dateTranslator"/>
>> <binding name="value" value="ognl:pageBean.customer.ado.birthday"/>
>> </component>
>>
>> I cant set the field like this:
>> <bean name="dateTranslator" 
>> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy[The date 
>> is wrong]"/>
>>
>> cause so the [The date is wrong] is intepreted as part of the pattern.
>> How can i set right?
>>
>> Best regards
>>
>> Rudolf B.
>>
>>
>>
>> Martin Strand wrote:
>>
>>> <binding name="validators" value="validators:required[This is my 
>>> message]"/>
>>>
>>> or if you want l10n, add a %
>>>
>>> <binding name="validators" 
>>> value="validators:required[%this.is.my.message.key]"/>
>>>
>>> Read more here:
>>> http://jakarta.apache.org/tapestry/UsersGuide/validation.html#validation.fields 
>>>
>>>
>>>
>>> On Fri, 27 Jan 2006 12:23:38 +0100, Rudolf Baloun 
>>> <Ru...@atron.de> wrote:
>>>
>>>> Hi,
>>>> i got this code in my *.page:
>>>>
>>>> <bean name="dateTranslator" 
>>>> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
>>>> <component id="inputBirthday" type="TextField">
>>>> <binding name="displayName" 
>>>> value="ognl:page.messagesUtil.birthdayMsg"/>
>>>> <binding name="validators" value="validators:required"/>
>>>> <binding name="translator" value="ognl:beans.dateTranslator"/>
>>>> <binding name="value" value="ognl:pageBean.customer.ado.birthday"/>
>>>> </component>
>>>>
>>>> I want to add use another validationmessage as the default message.
>>>> how can i set the validationmessage?
>>>>
>>>> <binding name="validators" value="validators:required, message=This 
>>>> is my message"/> doesnt work!?
>>>>
>>>> Anyone knows how to set the message?
>>>>
>>>> best regards
>>>>
>>>> Rudolf B.
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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


Re: How to set ValidationMessages in T4.0?

Posted by Rudolf Baloun <Ru...@atron.de>.
I found the solution in the api:
<bean name="dateTranslator" 
class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy,message=Date 
Wrong"/>
but can´t use an ognl expression like this:

<bean name="dateTranslator" 
class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy,message=ognl:page.wrongDateMessage"/>

is there a solution for my problem?

best regards

Rudolf B.



Rudolf Baloun wrote:

> Nice,
>
> i can set the message for the "required" - field with your solution.
> But i want to set the message for wrong Data-Input.
> My code again:
>
> <bean name="dateTranslator" 
> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
> <component id="inputBirthday" type="TextField">
> <binding name="displayName" value="ognl:page.messagesUtil.birthdayMsg"/>
> <binding name="validators" value="validators:required"/>
> <binding name="translator" value="ognl:beans.dateTranslator"/>
> <binding name="value" value="ognl:pageBean.customer.ado.birthday"/>
> </component>
>
> I cant set the field like this:
> <bean name="dateTranslator" 
> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy[The date is 
> wrong]"/>
>
> cause so the [The date is wrong] is intepreted as part of the pattern.
> How can i set right?
>
> Best regards
>
> Rudolf B.
>
>
>
> Martin Strand wrote:
>
>> <binding name="validators" value="validators:required[This is my 
>> message]"/>
>>
>> or if you want l10n, add a %
>>
>> <binding name="validators" 
>> value="validators:required[%this.is.my.message.key]"/>
>>
>> Read more here:
>> http://jakarta.apache.org/tapestry/UsersGuide/validation.html#validation.fields 
>>
>>
>>
>> On Fri, 27 Jan 2006 12:23:38 +0100, Rudolf Baloun 
>> <Ru...@atron.de> wrote:
>>
>>> Hi,
>>> i got this code in my *.page:
>>>
>>> <bean name="dateTranslator" 
>>> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
>>> <component id="inputBirthday" type="TextField">
>>> <binding name="displayName" 
>>> value="ognl:page.messagesUtil.birthdayMsg"/>
>>> <binding name="validators" value="validators:required"/>
>>> <binding name="translator" value="ognl:beans.dateTranslator"/>
>>> <binding name="value" value="ognl:pageBean.customer.ado.birthday"/>
>>> </component>
>>>
>>> I want to add use another validationmessage as the default message.
>>> how can i set the validationmessage?
>>>
>>> <binding name="validators" value="validators:required, message=This 
>>> is my message"/> doesnt work!?
>>>
>>> Anyone knows how to set the message?
>>>
>>> best regards
>>>
>>> Rudolf B.
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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


Re: How to set ValidationMessages in T4.0?

Posted by Rudolf Baloun <Ru...@atron.de>.
Nice,

i can set the message for the "required" - field with your solution.
But i want to set the message for wrong Data-Input.
My code again:

<bean name="dateTranslator"  
class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
<component id="inputBirthday" type="TextField">
        <binding name="displayName"  
value="ognl:page.messagesUtil.birthdayMsg"/>
        <binding name="validators" value="validators:required"/>
        <binding name="translator" value="ognl:beans.dateTranslator"/>
        <binding name="value"  
value="ognl:pageBean.customer.ado.birthday"/>
</component>

I cant set the field like this:
<bean name="dateTranslator"  
class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy[The date is 
wrong]"/>

cause so the [The date is wrong] is intepreted as part of the pattern.
How can i set right?

Best regards

Rudolf B.



Martin Strand wrote:

> <binding name="validators" value="validators:required[This is my  
> message]"/>
>
> or if you want l10n, add a %
>
> <binding name="validators"  
> value="validators:required[%this.is.my.message.key]"/>
>
> Read more here:
> http://jakarta.apache.org/tapestry/UsersGuide/validation.html#validation.fields 
>
>
>
> On Fri, 27 Jan 2006 12:23:38 +0100, Rudolf Baloun 
> <Ru...@atron.de>  wrote:
>
>> Hi,
>> i got this code in my *.page:
>>
>> <bean name="dateTranslator"  
>> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
>> <component id="inputBirthday" type="TextField">
>>         <binding name="displayName"  
>> value="ognl:page.messagesUtil.birthdayMsg"/>
>>         <binding name="validators" value="validators:required"/>
>>         <binding name="translator" value="ognl:beans.dateTranslator"/>
>>         <binding name="value"  
>> value="ognl:pageBean.customer.ado.birthday"/>
>> </component>
>>
>> I want to add use another validationmessage as the default message.
>> how can i set the validationmessage?
>>
>> <binding name="validators" value="validators:required, message=This 
>> is  my message"/> doesnt work!?
>>
>> Anyone knows how to set the message?
>>
>> best regards
>>
>> Rudolf B.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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


Re: How to set ValidationMessages in T4.0?

Posted by Martin Strand <ma...@entcap.se>.
<binding name="validators" value="validators:required[This is my  
message]"/>

or if you want l10n, add a %

<binding name="validators"  
value="validators:required[%this.is.my.message.key]"/>

Read more here:
http://jakarta.apache.org/tapestry/UsersGuide/validation.html#validation.fields


On Fri, 27 Jan 2006 12:23:38 +0100, Rudolf Baloun <Ru...@atron.de>  
wrote:

> Hi,
> i got this code in my *.page:
>
> <bean name="dateTranslator"  
> class="my.package.LenientDateTranslator,pattern=dd.MM.yyyy"/>
> <component id="inputBirthday" type="TextField">
>         <binding name="displayName"  
> value="ognl:page.messagesUtil.birthdayMsg"/>
>         <binding name="validators" value="validators:required"/>
>         <binding name="translator" value="ognl:beans.dateTranslator"/>
>         <binding name="value"  
> value="ognl:pageBean.customer.ado.birthday"/>
> </component>
>
> I want to add use another validationmessage as the default message.
> how can i set the validationmessage?
>
> <binding name="validators" value="validators:required, message=This is  
> my message"/> doesnt work!?
>
> Anyone knows how to set the message?
>
> best regards
>
> Rudolf B.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



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