You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTML5 validation not playing nicely with decimal numbers #4429
So- create a number field, set the type to decimal. Make a decimal. html 5 validation will object.
If the type = number? It's just not liking it.
Weirdly- a text field set to either number OR decimal does just fine with a decimal, but that's because the type in those cases is still text.
And I think we need to clarify in the docs the difference between a number field and a decimal field- for both text and decimal. But in a text field, it saves decimals ok, but drops the trailing zero if there is one.
Also note- if you switch back and forth between text and number types, the db doesn't always change. So don't test that way.
However it makes a sense if I switch the field type to "decimal" that I want some decimals. I'm submitting a PR that's setting default 2 digits after period if step is empty but the type is decimal
The difference with the text field as it's using text HTML input
Activity
intoeetive commentedon Aug 24, 2024
So technically this is correct - as the step is not set, the HTML Number input defaults step to 1 : https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number#step
However it makes a sense if I switch the field type to "decimal" that I want some decimals. I'm submitting a PR that's setting default 2 digits after period if step is empty but the type is decimal
The difference with the text field as it's using
textHTML inputResolved #4429 where setting Number input to decimal did not allow de…
robinsowell commentedon Aug 26, 2024
Man- I totally missed that the 'step' was in play! I agree- I'd still expect it to allow decimals regardless, but I should have spotted that!
Merge pull request #4435 from ExpressionEngine/bug/7.x/decimal-valida…