23Apr/099
sfWidgetFormInputCheckbox unchecked bug
Ever tried to create a Symfony form with a check box input field, which by default should be unchecked ? No ? Well read on because it's not that easy
.
This would be the code to print a check box input field in a Symfony form:
class CheckboxForm extends BaseCheckboxForm {
public function configure() {
$this->widgetSchema['field'] = new sfWidgetFormInputCheckbox();
}
}
When you use the form to create something then by default the check box should be unchecked. And when you use this form for editing, then the check box should be checked if the object you try to edit has already been checked in the past.
If you try this code, you'll see that the check box will always be checked. Even if you display this form to create a new object. Strange no ?
Tagged as: form, php, sfWidgetFormInputCheckbox, Symfony
Continue reading
Menu
Categories
Recent Comments
- Van de Voorde Toni on Symfony Forms Framework: Merge 2 forms
- Eby on Symfony Forms Framework: Merge 2 forms
- Van de Voorde Toni on Mantis in Eclipse with Mylyn
- seddik on Symfony Forms Framework: Merge 2 forms
- newton on Mantis in Eclipse with Mylyn
Calendar
Tags
add-ons
book
browser
Chrome
code
constructor
css
date
datepicker
design
developer
doctype
dom
eclipse
event
fabien Potencier
factory
form
framework
functions
Google
googleplex
html5
Interview
Javascript
john resig
Jquery
Layout
mysql
oop
option
options
pattern
photoshop
php
query
security
select
svn
Symfony
table
tag
tips
twitter
year
Archives
- February 2010
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008