My Symfony model has a field which is boolean but also accepts NULL so effectively is a tri-state value.
How can I write a widget for this? Symfony auto-generates a sfWidgetFormCheckbox but that can not be set to NULL.
I tried a sfWidgetFormChoice with but I had to specify the values as strings to get them work:
$this->setWidget('wt', new sfWidgetFormChoice(array(
'choices' => array(true => 'true', false => 'false', null => 'null')
)));
It works for storing values but whenever I save a "false" value, the select jumps back to 'null'. I tried several combinations of 'false', '0', '' etc. but got nothing to work in all three cases.
Any ideas?
'null' => 'null'and creating a custom validator that looks for the stringnulland returns the proper value?