Hi,

I checked the Doctrine docs, and it specifies that a boolean field can be
used as a ternary by using NULL as a third value - ie: null, 0, 1.

I'm trying to create a form with a drop down with those three options: Yes
(1), No (0) and blank (null).  However, I'm not sure how to do this
properly.

I've tried:
'is_previously_published' => new sfWidgetFormChoice( array( "choices" =>
array( null => "Please Pick", "1" => "Yes", "0" => "No" ) ) ),

but that doesn't seem to work.  Whether I choose No or Please Pick, the
option always appears upon refresh as Please Pick (ie: the
sfWidgetFormChoice seems to equate 0 and null as the same thing).

I also had to create my own ValidatorBoolean that dealt with a ternary 
option, as sfValidatorBoolean doesn't allow for a null value for a boolean.

But, not suprisingly, NULL and 0 are the same in the widget.  Do I have to 
create my own choice widget as well?


Is there an easy way to get this to work?  Or is my only choice to change my 
schema from a boolean to a string?


Thanks,

Eric








-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to