Skip to content

Instantly share code, notes, and snippets.

@Kalyse
Created February 8, 2011 12:08
Show Gist options
  • Save Kalyse/816339 to your computer and use it in GitHub Desktop.
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.
// 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