How to set value of checkbox in magento custom module

后端 未结 2 687
我寻月下人不归
我寻月下人不归 2020-12-21 02:56

How do I set the value of a checkbox in a magento custom module? Also, how do I set the name of the checkbox to the value in an array?

Here is the code I use to put

2条回答
  •  被撕碎了的回忆
    2020-12-21 03:26

    values (ending with 's') is for a select field: try value (singular)
    sorry about that, try this instead:
    Assuming $entity is the object you're working with, after the $fieldset declaration:

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

    Check out Mage_Adminhtml_Block_Customer_Edit_Tab_Account (line 142) to see how the core do it.

提交回复
热议问题