Development

#3996 (Boolean default values aren't rendered correctly with symfony's input form widget)

You must first sign up to be able to contribute.

Ticket #3996 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

Boolean default values aren't rendered correctly with symfony's input form widget

Reported by: tommyd Assigned to: fabien
Priority: major Milestone: 1.1.1
Component: view Version: 1.1.0
Keywords: Cc:
Qualification: Ready for core team

Description

I work with the BOOLEAN field emulation of propel (i.e. data are stored as tinyint, but handled throughout propel properly with the boolean values "true" and "false"). After I created a couple of forms and a couple of test CRUD views, I noticed that obviously symfony properly displays now checkboxes instead of simple input boxes for these fields, all fields were checked by default, because the value which decided if the checkbox should be ticked or not was just tested for is_null() rather than boolean false.

Attached is a patch which fixes this bug.

Attachments

form_input_checkbox.patch (427 bytes) - added by tommyd on 07/14/08 18:24:25.
If the given field value is neither null nor boolean false, tick the checkbox
form_input_checkbox.2.patch (1.6 kB) - added by Carl.Vondrick on 07/14/08 20:33:50.
Updated patch with unit tests

Change History

07/14/08 18:24:25 changed by tommyd

  • attachment form_input_checkbox.patch added.

If the given field value is neither null nor boolean false, tick the checkbox

07/14/08 19:28:49 changed by Carl.Vondrick

  • component changed from other to view.
  • qualification changed from Unreviewed to Ready for core team.

Similar to #3825.

07/14/08 20:33:50 changed by Carl.Vondrick

  • attachment form_input_checkbox.2.patch added.

Updated patch with unit tests

07/14/08 20:34:23 changed by Carl.Vondrick

As with #3825, I think we have a slight BC problem, but I would expect this behavior.

07/15/08 07:24:29 changed by FabianLange

  • milestone set to 1.1.1.

I dont think that we have a BC issue here. this looks really like a bug for me. false means: No, please dont check. I think we dont have to be BC with bugs.

07/15/08 11:20:28 changed by tommyd

Thanks for adding the unit test to the patch - I will try and add these for any of my next patches myself.

Out of curiousity, what does "BC" stand for? "Be Careful"? Sorry, I don't get this acronym...

07/15/08 18:59:52 changed by Carl.Vondrick

BC = Backwards Compatible

07/16/08 00:12:36 changed by Carl.Vondrick

  • status changed from new to closed.
  • resolution set to fixed.

(In [10306]) 1.2: fixed handling boolean values in radio and checkbox widgets (closes #3825, #3996, #4002)

07/16/08 09:59:20 changed by tommyd

Thanks for applying both patches, Carl!

One question, though: This is our first project with symfony and we're currently (obviously) sticked to the latest stable release 1.1 - are there any major deal breakers implemented / about to be implemented in 1.2 which would make an upgrade to 1.2 later on extraordinary hard? Again, since this is our first project, we have not much experience what it means to keep your development pace ;)

If it would be extraordinary hard to update from 1.1 to 1.2 I'd certainly like to backport the changes from the 1.2 to the 1.1 branch and vote for a minor release...

07/16/08 18:20:29 changed by Carl.Vondrick

The 1.1 and 1.2 branches are nearly identical right now. See the symfony roadmap: http://www.symfony-project.org/blog/2008/07/01/symfony-1-2-roadmap

07/17/08 22:55:14 changed by Carl.Vondrick

PS: This has been fixed in the 1.1 branch as well. See r10307

08/01/08 16:44:43 changed by nicolas

(In [10581]) [1.1] fixed Boolean default values aren't rendered correctly with symfony's input form widget (closes #3996)

08/01/08 16:45:43 changed by nicolas

(In [10582]) [1.2] backport of r10581 - fixed Boolean default values aren't rendered correctly with symfony's input form widget (refs #3996)