Closed Bug 1341613 Opened 8 years ago Closed 6 years ago

Number input element does not display leading 0

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1005603

People

(Reporter: youwontforgetthis, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36 Steps to reproduce: Using FF 50.1.0 If you visit https://jsfiddle.net/7t92qmsd/ you can see that the number input element does not display a leading 0 yet it is there as the "value". We have server side validation that returns the user to the page with a message of "invalid date" but displayed to the user is a valid looking year. The user will submit again and will again hit the server side validation. I would suggest that an input element should always display exactly what it would POST. Chrome displays the leading 0 in a number field. Expected results: The "value" that gets posted should always match what is displayed on screen to avoid user confusion. If you decide that leading zeros are not allowed in number fields then it should be removed from the value that gets POSTed as well as the field. Our preference would be for you to mimic the chrome behaviour which is to keep the leading 0 visible until you change the value at which point it gets dropped.
Just wanted to add some context about why we wouldn't just drop the leading 0 server side. We are building a government tool and the decision has been taken that we never modify what the user has typed in as it forms part of a legal contract. If they accidentally include a leading 0 we choose to instead give them a validation message and allow the user to correct the value.
Blocks: number-input
Component: Untriaged → Layout: Form Controls
Keywords: testcase
Product: Firefox → Core
(In reply to undefined from comment #undefined) >
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.