Scott Eade wrote:
Is there a way to get intake to use the locale from the parameter parser
as the source of the date format?
I am overriding RunData.populate() and invoking setLocale() with the
user's locale which updates the parameter and cookie parsers, but it
seems that I need to do something else in order to get intake to use it.
The Intake fields get their locale from the parameter parser. See
Field.java:325. Now, the problem is that DateStringField is
locale-agnostic. It uses its default validator which in turn uses one of
the date formats defined in the constraint rules. I thought this would
be flexible enough.
To overcome this limitation, you could derive from DateStringField and
change the type of the field to "custom" in intake.xml. Add an attribute
fieldClass="foo.bar.MyDateStringField" to the field definition to use
your own field type. It is also possible to use a custom validator:
Derive from DateStringValidator and override the assertValidity(Field)
method. The Field provided here has your locale available.
Bye, Thomas.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]