We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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?!



11.6k
Accepted
answer

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