Created
February 8, 2011 12:08
-
-
Save Kalyse/816339 to your computer and use it in GitHub Desktop.
Setting the decorator to ViewHelper on a Zend_Dojo_Form means your CheckBox won't visually show as unchecked.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Zend_Dojo_Form returned by getForm() | |
// Having the decorator as "ViewHelper" means you cannot visually display the checkbox as unchecked. | |
// Does not work | |
$this->getForm()->addElement( | |
'CheckBox', | |
$attraction['id'], | |
array( | |
'label' => $attraction['attraction'], | |
'decorators' => array( | |
'ViewHelper', | |
array('Label', array( 'placement' => 'append')), | |
), | |
'checkedValue' => '1', | |
'uncheckedValue' => '0', | |
'checked' => false | |
)); | |
// DijitElement as the decorator works | |
$this->getForm()->addElement( | |
'CheckBox', | |
$attraction['id'], | |
array( | |
'label' => $attraction['attraction'], | |
'decorators' => array( | |
'DijitElement', | |
array('Label', array( 'placement' => 'append')), | |
), | |
'checkedValue' => '1', | |
'uncheckedValue' => '0', | |
'checked' => false | |
)); | |
// Now you can... | |
$this->getForm()->getElement( $attraction['id'] )->setValue( 0 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment