You should be able to specify your date format using the translator
binding prefix.
e.g.

<component id="..." type="TextField">
    <binding name="translator" value="translator:date,pattern=yyyy-mm-dd"/>
</component>

The translator binding prefix has some unfortunate syntax limitations. 
If your date pattern contains problematic characters (e.g. a comma) then
it will choke.  If this is the case, define your translator as a bean.
e.g.
<bean name="dateTranslator"
class="org.apache.tapestry.form.translator.DateTranslator">
    <set name="pattern" value="literal:yyyy-mm-dd"/>
</bean>

<component id="..." type="TextField">
    <binding name="translator" value="bean:dateTranslator"/>
</component>

Paul

Malin Ljungh wrote:
> Thank you Paul.
>
> It is the localized format of the date that is not working. My app is
> localized to Swedish and the 'sv' date format is yyyy-mm-dd but the only
> thing that works with the date translator is mm/dd/yyyy I think.
>
> Malin
>
> On 6/21/06, Paul Ferraro <[EMAIL PROTECTED]> wrote:
>>
>> That syntax is documented here:
>>
>> http://tapestry.apache.org/tapestry4/UsersGuide/validation.html#validation.fields
>>
>>
>> What aspect of localization is not working?  The format?  date symbols?
>> or validation error messages? all of the above?
>> The format is unfortunately hard coded and can be overridden.  The date
>> symbols use the locale from the request.  Same for validation messages.
>>
>> Paul
>>
>> Malin Ljungh wrote:
>> > Thank you Bryan!!!
>> > It works! How did you come up with that "mysterious" syntax? Is there
>> > documentation that I have missed somewhere?
>> >
>> > Just one problem left - localization of my date translator. Anyone
>> have
>> a
>> > suggestion, please?
>> >
>> > Malin
>> >
>> > On 6/17/06, Bryan Lewis <[EMAIL PROTECTED]> wrote:
>> >>
>> >> On your question about the 'required' validator...  the syntax that's
>> >> been working for me in such a case is:
>> >>
>> >>         <binding name="validators"
>> >> value="validators:required,$minDate"/>
>> >>
>> >>
>> >>
>> >> Malin Ljungh wrote:
>> >>
>> >> > - How do I apply the required validator to the Date2?
>> >> >
>> >> > > I tried this:
>> >> > >         <binding name="validators"
>> >> > value="validators:required,bean:minDate"/>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to