Paul! I've got so much useful help her that my brain is now totally atrophied - you'll just have to help me a little bit more :)
My app is actually localized - I have the "sv" (Swedish) and the "en" locales. Thus, I would like yyyy-mm-dd in the sv-case and something else (is it mm/dd/yyyy?) in the en-case. Maybe I could make a getLocalizedDatePattern() in my basepage class and do <bean name="dateTranslator" class=" org.apache.tapestry.form.translator.DateTranslator"> <set name="pattern" value="localizedDatePattern"/></bean> Would that work? Or is it a better way? Malin On 6/22/06, Paul Ferraro <[EMAIL PROTECTED]> wrote:
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]