/ Published in: PHP
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
class sfWidgetFormInputiPhoneCheckbox extends sfWidgetFormInputCheckbox {
{
$this->addOption('checked_label');
$this->addOption('un_checked_label');
parent::__construct($options, $attributes);
}
{
$str = parent::render( $name, $value, $attributes, $errors );
$checkedLabel = $this->getOption("checked_label");
$uncheckedLabel = $this->getOption("un_checked_label");
$id = $this->generateId($name);
$str .= <<<eof><script type="text/javascript">
$(document).ready( function(){
$('#$id').iphoneStyle({
checkedLabel: '$checkedLabel',
uncheckedLabel: '$uncheckedLabel'
});
});
</script>
EOF;
return $str;
}
}
'show-upcoming-events-nav' => new sfWidgetFormInputiPhoneCheckbox( array("checked_label" => "on", "un_checked_label" => "off") ),
));
URL: http://shout.setfive.com/2010/10/13/iphone-style-checkboxes-for-symfony/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                