How to set value of checkbox in magento custom module -


how set value of checkbox in magento custom module? also, how set name of checkbox value in array?

here code use put checkbox in magento module:

$fieldset->addfield($entity_id['colorcode'], 'checkbox', array(       'label'     => mage::helper('selectcolorforimage')->__($entity_id['colorcode']),       'name'      =>'assign_color_new[]',       'values'    =>$entity_id['colorcode']    ));  

values (ending 's') select field: try value (singular)
sorry that, try instead:
assuming $entity object you're working with, after $fieldset declaration:

$entity->setdata('assign_color_new[]', $entity_id['colorcode']); 

check out mage_adminhtml_block_customer_edit_tab_account (line 142) see how core it.


Comments