4 Replies Latest reply: Jun 26, 2014 3:09 AM by Truong Van Hoang RSS

    Validation error after format number and date globally

    Truong Van Hoang

      Hi all,

       

      I format all date fields in may app by adding the formatting-locale tag in trinidad-config.xml (<formatting-locale>en-GB</formatting-locale>),

      follow idea in this page http://soadev.blogspot.ch/2010/03/change-global-date-format-of-your.html

      Then I format (0.00) all my number fields by extends ViewRowAttrHintsImpl class (override getFormat, getFormattedAttribute, getFormatter, getFormatterClassName methods),

      follow idea in this page http://andrejusb.blogspot.ch/2014/05/implementing-dynamic-date-type.html

       

      All the date and number fields are showed with correct format, but the validation is wrong for number fields (only work with 'en' locale).

      With 'fr' locale, a number field with value 559,40 (',' is decimal seperator).

      But when I try to save the same value 559,40 to the field, this error is showed 'Le format du nombre doit correspondre au modèle suivant : 0.00'

      And when I try to save value 559.40, this error is showed 'For input string: "9,"'

       

      If I remove the formatting-locale tag, the validation is correct again but I want to keep the format for date field.

      Anyone know any workaround or another solution?

       

      Thanks,

      Hoang