Input with type="number" and field rules "required|numeric" is not validating for a specific type of numbers
See original GitHub issueI’ve faced a problem where a field is not valid if the value of it is something like this: +32.45
- decimal with a positive sign
I thought the problem was in the validatorjs
but it’s validating these cases.
Test cases:
- “+32” ->
true
- “32.45” ->
true
- “-32.45” ->
true
- “+32.45” ->
false
I’ve created a sandbox with a form and a sandbox with only validatorjs
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
<input type="number"> - HTML: HyperText Markup Language
A number input is considered valid when empty and when a single number is entered, but is otherwise invalid. If the required attribute...
Read more >Why the number input is the worst input - Stack Overflow Blog
Either way when the number is invalid you can't get the actual value that appears on screen in the <input type="number"> field:
Read more >How to make HTML input tag only accept numerical values?
This input field allows only numerical values. You can also specify the minimum value and maximum value that should be accepted by this...
Read more >How to Allow Only Positive Numbers in the Input Number Type
In this snippet, we'll demonstrate how to allow only positive numbers in the input number type. You can use the “min” attribute to...
Read more >How to force Input field to enter numbers only using ...
By default, HTML 5 input field has attribute type=”number” that is used to get input in numeric format. Now forcing input field type=”text” ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@foxhound87 you mean by removing this part
field.bind({ type <--, placeholder })
? If so, that’s exactly the reason the input getstext
type and it’s not reproducingIt’s not even working with the value “+32” for some reason