1

I want to submit decimal values through html input box. But showing input error as "invalid input" when giving value 1.5 where min=0 and max=3.

html code is given below:

<input type="number" required  value="<?php echo $someDecimalvalue; ?>"  min="0" max="3" >
Dayz
  • 269
  • 2
  • 12
  • 3
    I suppose this will help You [link](http://stackoverflow.com/questions/19011861/is-there-a-float-input-type-in-html5) – A.Mikhailov Nov 29 '16 at 07:48

2 Answers2

3

There is an attribute step for this purpose:

Works with the min and max attributes to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this attribute is not set to any, the control accepts only values at multiples of the step value greater than the minimum.

So if you want to allow one decimal place, add step="0.1" to your input tag.

simon
  • 2,896
  • 1
  • 17
  • 22
0

<input type="number"> only accepts integers.

roberrrt-s
  • 7,914
  • 2
  • 46
  • 57