He is setting the default values for a form, by getting the values from a Doctrine object like this, "$object->toArray()". Columns in Doctrine which are boolean get hydrated to php type boolean. This array does not seem to be able to be passed directly to the form for yes/no radios or single checkbox and automatically recognized and converted to the html counterpart value 1 and 0. The checkbox or radio ends up with value="1" for true and value="" for false.
- Jon On Thu, May 15, 2008 at 5:15 AM, Fabien POTENCIER < [EMAIL PROTECTED]> wrote: > > I'm not sure I understand the problem here. A checkbox and a radio > button can have values that are not Booleans. > > Can you give an example of what does not work like you think it should? > > Fabien > > -- > Fabien Potencier > Sensio CEO - symfony lead developer > sensiolabs.com | symfony-project.com | aide-de-camp.org > Tél: +33 1 40 99 80 80 > > > Ian wrote: > > There are often times when populating the "default" values of a form, > > where I may be passing in a php boolean true/false value, and > > currently the sfForm framework cannot parse this correctly. > > > > For example, I when you have a field in doctrine that is defined as a > > boolean, it will return php type true or false, as the value of that > > field, regardless of if it is stored in the db as 1 or 0. > > > > However, if I have a radio button or check box widget that is > > technically a boolean, it should recognize if I pass a php type true/ > > false into the default value for that tag and properly type cast this > > to an integer, 1 or 0 respectively. An HTML form can never hold a php > > boolean value, so I don't see how this would ever harm anything. > > > > I took a look at the code, and there are several possible place where > > this check/conversion could take place, but I think its up to you, > > Fabien, to decide where this should go. I would assume it would be > > best coverted just before HTML output. > > > > Thoughts? > > > > --Ian > > > > > > > > > > > > -- Jonathan Wage http://www.jwage.com http://www.centresource.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" 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-devs?hl=en -~----------~----~----~----~------~----~------~--~---
