Closed
Bug 1350240
Opened 8 years ago
Closed 7 years ago
<input type="number" required> with 3 numbers after "." is considered ас valid, but this is error
Categories
(Core :: Layout: Form Controls, defect, P4)
Tracking
()
RESOLVED
DUPLICATE
of bug 1509057
People
(Reporter: arktuz, Unassigned)
References
()
Details
(Keywords: qawanted, testcase)
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.100 Safari/537.36
Steps to reproduce:
<input type="number" required />
For example: https://jsfiddle.net/ArtKuz/owg5bz93/
Actual results:
0 - valid - true
0.1 - not valid - true
0.11 - not valid - true
0.111 - valid - false
0.1111 - not valid - true
Expected results:
0 - valid - true
0.1 - not valid - true
0.11 - not valid - true
0.111 - valid - true
0.1111 - not valid - true
FIX:
Expected results:
0 - valid - true
0.1 - not valid - true
0.11 - not valid - true
0.111 - not valid - true
0.1111 - not valid - true
Comment 2•8 years ago
|
||
It works as expected for me. I see a red outline around the <input> for all
the values listed, except 0. Both in Firefox 52.0.1 and Nightly on Linux64.
Comment 4•8 years ago
|
||
I can reproduce this as well on Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:54.0) Gecko/20100101 Firefox/54.0 (locale: nl)
When testing in Chrome and Edge, these numbers are seen as invalid. Do note that in these browsers you need to add a form tag around the input field to make the validation work. Not sure if that's some part of a spec.
I've slightly adjusted the fiddle at https://jsfiddle.net/Glodenox/owg5bz93/2/ to display the value as I found out that when entering 0.111, the value of the field becomes 111 for some reason. This is why it is seen as a valid value. This can also be performed by repeating any other digit 3 times, though 0 seems to result in a value of 0.000
Comment 5•8 years ago
|
||
I tried to reproduce this bug using Nightly from 2017-03-24, release Firefox 52.0, 54.0 and 55.0 build 3 on Ubuntu 16.04 x64bit, but unfortunately I can't seem to reproduce the problem. No matter how many numbers I entered, I was always warned that the number was invalid if it contained any numbers after "." (if it wasn't an integer number like: 1, 2, 67 etc.).
Comment 6•8 years ago
|
||
I'm suspecting this might be related to the locale being used. In my locale (nl), the decimal is used to separate the thousands (whereas in other languages that would be a comma). If I use a comma instead of a decimal, I get the same message as you saying it isn't an integer number. So I assume you'll get the result that I'm seeing when you enter 0,111 instead of 0.111.
Comment 7•8 years ago
|
||
I've just quickly checked that myself. When I switch to the en-US locale, I get the value 111 for input 0,111 without any validation errors. I'm even more certain that it is related to the thousands separator as entering 0,111,111 gives the value 111111.
Comment 8•8 years ago
|
||
Thank you very much, Tom. I never even considered that possibility. I usually write thousand with spaces between the numbers(example: 10 000, not 10,000 or 10.000). That was a really good catch.
I retested everything and the bug is reproducing even on Firefox RC 4.0.1 (I tested even on the latest Nightly) So I think it's safe to say that this problem has been reproducing since the beginning. But I think it should be marked as an enhancement.
![]() |
||
Updated•7 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•