Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3591

NumberTextField and RangeTextField should always render/parse its value with English locale

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5-RC3
    • 1.5-RC4
    • wicket
    • None
    • client with a locale where the decimal mark is not a period (for example: Hungarian locale)

    Description

      Wicket started adding some support for the new Html5 input types. Among these are NumberTextField for number type [1] and RangeTextField for range type [2]. The Html5 spec mandates that the "value", "min", "max" attributes for these inputs are floating point numbers. Html5 spec also describes the format of a float number [3]. Simply to say it is a number formatted with English locale (for example: decimal mark is a period).

      Wicket currently renders min and max spec compliant but renders the value wrong because it uses the client locale for that. Which means for example for a Hungarian client it will generate "3,14" instead "3.14". This breaks the custom widgets used by browsers for these new inputs (Chrome and Opera have custom ui, FF and IE stil use plain text field) because they expect the value with a period decimal mark. This means that browsers will post the value formatted in English locale too so parsing is also broken for these on the wicket server side because the client locale is used there also.

      Imho wicket should always use the English locale for rendering/parsing these values in case of these input types.

      To reproduce you can use the form examples from "wicket-html5-examples" in the wicketstuff project (I found this bug there).

      [1] Html5 input number type: http://dev.w3.org/html5/markup/input.number.html
      [2] Html5 input range type: http://dev.w3.org/html5/markup/input.range.html
      [3] Html5 float datatype: http://dev.w3.org/html5/markup/datatypes.html#common.data.float

      Attachments

        1. fix-WICKET-3591.patch
          0.7 kB
          Attila Király

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              akiraly Attila Király
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: