My name is Svetoslav Marinov, which has short forms such as Slavi and Svetlio. I am originally from Bulgaria, Europe. Currently, I live in Ontario, Canada and I am working as a Web Developer. With my blog I want to share my knowledge and exchange ideas. www.devcha.com www.slavi.biz Svetoslav is a DZone MVB and is not an employee of DZone and has posted 12 posts at DZone. You can read more from them at their website. View Full User Profile

How to use Zend Framework's formCheckbox View Helper

07.18.2011
| 5474 views |
  • submit to reddit
I am almost always going back to check the syntax of  formCheckbox Zend Framework View Help so I decided to post it here.
<?php echo $this->formCheckbox('data[enabled]', 1, null, array(1, 0)); ?>
OR
<?php echo $this->formCheckbox('data[enabled]', 1, !empty($this->data['enabled']) ? array('checked' => 1) : null); ?>
References
Published at DZone with permission of Svetoslav Marinov, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: