numeric field editing broken
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
If I have a field in my domain class:
`Long myField`
and that field has a value of 1000000. It ends up generating this HTML:
``
Those commas mean that the value is never seen because html numeric fields don't like commas.
Tracing the code, this comes from FormFieldsTagLib.groovy line 729:
`attrs.value = numberFormatter.format(propertyAccessor.value)`
As far as I can see, there should never be locale specific formatting for input fields. Display fields... maybe. But not input fields.
Furthermore, if the type of the field is float or big decimal, the input field looks like this:
``
as far as I know "number decimal" is completely invalid html. Furthermore, if you put a constraint on the field of say min: 0.0 it will generate this:
`
`
with a min="0.0" attempting to enforce the minimum. Which doesn't work because the browser falls back to "text" for the invalid "number decimal", and therefore min= is ignored by the browser.
This is all very broken, not a minor bug here!
3.0.0.RC1
Contributor guide
Research direction
Read FormFieldsTagLib.groovy around line 729 and trace numeric, float, and BigDecimal field rendering. Reproduce the generated inputs described in the report, then verify that numeric values are not locale-formatted and decimal fields emit valid HTML type and min attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100