[eluser]dignick[/eluser]
I'm using set_radio to fill in a radio field. If the value of the radio is 0, then CodeIgniter will not set the radio to checked.
The reason for this is that the value being passed to set_radio is a numerical 0 and the condition (0 == '') returns true, which is tested near the bottom of the set_radio function in the Form_validation library:
Code:
if (($field == '' OR $value == '') OR ($field != $value))
{
return '';
}
It is the $value == '' test that is the problem here. If this is changed to $value === '' the field gets checked as expected.
The problem is set_radio expects a string to be passed to it, but should it not also work with a number?