Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Form element numeric - float?

I feel like I am doing something really stupid here. I want a field that is Numeric but allows decimal places. In the form:

$price = new Numeric('price',array('placeholder'=>'Price'));
$price->setFilters(array('float'));
$this->add($price);

When I try to use this in the page with a value like 12.5 I get "please enter a valid value. the two nearest valid values are 12 and 13." Doesn't Numeric support floats?!



7.6k
Accepted
answer

try to add "step=any" as property of your html number element