florianMo opened a new pull request, #913:
URL: https://github.com/apache/ofbiz-framework/pull/913

   Fixed: Decimal numbers not displayed correctly in input type=number
   (OFBIZ-13297)
   
   ### `<input type="number"/>` does not accept decimals
   
   Now that we use `<input type="number"/>` 
(https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/number,
 https://issues.apache.org/jira/browse/OFBIZ-13183) to display numeric values 
in forms, it is not possible to enter decimal values.
   
   We need to support the `step` attribute 
(https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#step),
 and use `any` as default value, since `any` will allow any decimal value. This 
means adding a new `step` attribute on the `<text/>` form field, and render it 
as a `step` attribute on the HTML `<input type="number"/>`.
   Supporting this attribute, developer will be able to define which kind of 
value he expects (integer, one decimal, two decimals...).
   
   ### `<input type="number"/>` does not display decimal values correctly
   
   `<input type="number"/>` are sensitive to the decimal separator used in 
their `value` attribute. Depending on the browser and the 
[lang](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang)
 used, an input may or may not display its value in the HTML field. For example 
:
   
   * Firefox 143.03
        * `<input type="number" lang="en" value="1.2"/>` -> displays `1.2`
        * `<input type="number" lang="en" value="1,2"/>` -> displays `1,2`
        * `<input type="number" lang="fr" value="1.2"/>` -> displays `1,2`
        * `<input type="number" lang="fr" value="1,2"/>` -> displays `1,2`
    * Chrome 141
        * `<input type="number" lang="en" value="1.2"/>` -> displays `1,2`
        * `<input type="number" lang="en" value="1,2"/>` -> displays nothing
        * `<input type="number" lang="fr" value="1.2"/>` -> displays `1,2`
        * `<input type="number" lang="fr" value="1,2"/>` -> displays nothing
   
   It vould seem reasonable to always use the same locale (`en` for example) to 
format numeric values before inserting it in a HTML input, and let the browser 
decide which decimal separator to use.
   
   Thanks: Néréide team
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to