If you have a form where you have declare a input type as below:
Now if you enter a floating-point/decimal value like '2.1' and try to process your form then you will get the following error message:
"Please enter a valid value. The two nearest valid values are 2 and 3."
step="any"
to your form. So, your input code should be as follows:
Now, you should be able to enter decimal/floating-point values and process them without any hassle.
<input type="number" name="quantity" min="1" max="5">
Now if you enter a floating-point/decimal value like '2.1' and try to process your form then you will get the following error message:
"Please enter a valid value. The two nearest valid values are 2 and 3."
Click on image to enlarge |
Solution:
To solve this just addstep="any"
to your form. So, your input code should be as follows:
<input type="number" name="quantity" min="1" max="5" step="any">
Now, you should be able to enter decimal/floating-point values and process them without any hassle.
thanks, it worked!
ReplyDeleteThanks 😊 you saved my project
ReplyDeleteThank you, this helped me with my project
ReplyDeleteThanks a lot. It helps might.
ReplyDeleteS
ReplyDeleteThanks
ReplyDeleteThanks a lot for helping me and my project <3
ReplyDeleteThank you.. you help me alot
ReplyDelete