Trouble using floats with numerical validator

I wrote a unit test for a model attribute whose rule follows:




		array('percent', 'numerical', 'allowEmpty' => true,

				'integerOnly' => false, 'min' => 0, 'max' => 100),



The test only succeeds when I set the value to an integer. It fails for every float value. I’m using mySQL, and the column type is FLOAT.

I have even tried it using ‘min’=>0.0 and ‘max’=>100.0, but that doesn’t fix it.

What am I doing wrong? Thanks!

Hi there,

Have you checked if ‘percent’ is within any other rules? if that is so, get rid of it (apart from the ‘on’=>‘search’ scenario. After that, you dont need to put allowEmpty and integerOnly as they come like that by default.

Cheers