Input number validation and letter 'e'
See original GitHub issueI’m submitting a … (check one with “x”)
[ x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
User can type letter “e” in input type=“number” fields and any value containing one or many letters “e” is considered valid. Also, having letters “e” in input breaks pattern validation.
Expected behavior I assume it is possible to use exponential notation in number inputs, but the value still should be tested as a valid number, and pattern validation still should be applied.
Minimal reproduction of the problem with instructions
http://plnkr.co/edit/1aQRuixe6f9bzN0Wf2RU?p=preview
- Try to type “eeeeeeeeee”. This is considered a valid number
- Try to type “123456”. Pattern validation works as intended and the field is invalid
- Now add letter ‘e’ : “123456e”. The field is now considered valid
- Conclusion: Letter ‘e’ is not taken in account for number validation and breaks pattern validation.
What is the motivation / use case for changing the behavior?
This is a silent failure in the validation process of number inputs, that currently needs to be manually adressed with input event handlers.
Please tell us about your environment: Windows 7
-
Angular version: 2.0.0
-
Browser: Chrome 53
-
Language: all
Issue Analytics
- State:
- Created 7 years ago
- Reactions:7
- Comments:5 (2 by maintainers)
Per the stackoverflow link, that would explain why a single ‘e’ is allowed, but not why ‘eeeeeeee’ is allowed as that shouldn’t be a valid number. The ‘eeeeeee’ input is allowed in Chrome (with and without angular) but breaks in firefox. Firefox does not like the input with an ‘e’ unless its a single ‘e’ and followed by at least one number.
This boils down to an issue with Chrome specifically, not angular, though angular could attempt to work around it.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.