Number input element does not display leading 0

RESOLVED DUPLICATE of bug 1005603

Status

()

RESOLVED DUPLICATE of bug 1005603
2 years ago
3 months ago

People

(Reporter: youwontforgetthis, Unassigned)

Tracking

(Blocks: 1 bug, {testcase})

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
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.
(Reporter)

Comment 1

2 years ago
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.

Updated

2 years ago
Blocks: 945309
Component: Untriaged → Layout: Form Controls
Keywords: testcase
Product: Firefox → Core
See Also: → bug 1005603

Comment 2

7 months ago
(In reply to undefined from comment #undefined)
>
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1005603
You need to log in before you can comment on or make changes to this bug.