Hi Florian, All,

I thought about it, and you are right.

One of the (old?) American saying I totally agree with is the mantra "If it ain't broke, don't fix it". We lack that in our "modern" troubling consumerist world.

To be clear, in our case before the regression there was no limit on decimals 
and it worked quite well.

So indeed no need to get further than "any" :)

Jacques

Le 06/10/2025 à 14:05, Florian Motteau a écrit :
Hi all,

Jacques spotted a regression following https://issues.apache.org/jira/browse/OFBIZ-13183, in which I introduced a new "type" attribute on input fields :

<text type="[text|number|email|password|tel..."/>

This attribute controls the "type" attribute on the resulting HTML <input/> :

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#type

The main goal was to implement the HTML standard way to specify which kind of data the user can enter, but also to be able to rely on native browser validation. In other word, the goal was to get closer to the standard HTML way.

It appears that an <input type="number"/> cannot receive a decimal value, unless we add a "step" attribute that define the granularity (step="0.01", step="0.1", step="1", and step="any" will allow all decimal values).

In https://issues.apache.org/jira/browse/OFBIZ-13183 we also defined that every numeric field would be entered with an <input type="number"/>, wihtout a default value for the "step" attribute. It results that for all entity-auto forms, numeric fields cannot receive decimal values. Which is a problem :).

To tackle this, we could

 * add step="any" on all <input type="number"/>, so when using <text
   type="number"/> there is no limitation about decimals on the value
   entered,
 * support a new attribute "step" on <text type="number"/>, that would
   be rendered as step="..." on the HTML input, so we can choose on
   each field what behaviour we want about decimals (this attribute
   could have "any" as a default value) <-- I would go with this
 * hold a default value in arithmetic.properties, but I feel that this
   property file is more about rules about numeric values in different
   functional contexts, and less about pure user interface concerns

Maybe we could think of something else, or revert the whole thing altogether 
:), anyway I would be glad to fix this.

What do you think ?

Florian

 * https://issues.apache.org/jira/browse/OFBIZ-13297
 * https://issues.apache.org/jira/browse/OFBIZ-13183
 * https://github.com/apache/ofbiz-framework/pull/862
 * 
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#type
 * 
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/number#step

Reply via email to