He says that when the form is submitted, value="1" works, but value="" does nothing. I assume because the form things no data was submitted for that field.
- Jon On Thu, May 15, 2008 at 8:21 AM, Fabien POTENCIER < [EMAIL PROTECTED]> wrote: > > > > Jonathan Wage wrote: > > 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. > > which looks good, no? > > Fabien > > > > > - Jon > > > > On Thu, May 15, 2008 at 5:15 AM, Fabien POTENCIER > > <[EMAIL PROTECTED] > > <mailto:[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 <http://sensiolabs.com> | symfony-project.com > > <http://symfony-project.com> | aide-de-camp.org > > <http://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 > > > > > > > > -- 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 -~----------~----~----~----~------~----~------~--~---
