如何在复选框中设置值

时间:2011-04-29 13:33:25

标签: magento

  

可能重复:
  how to set value in checkbx in magento custom module.

表格是insertcolor。和colorcode是insertcolor表的字段。 所以首先从insertcolor表中获取所有数据。然后将此数据添加到复选框字段中。所以id显示但值不显示。在id和value中我输入相同的值但不显示在checkbox的值字段中。

$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$readresult=$write->query("SELECT * FROM insertcolor" );
while ( $row = $readresult->fetch() ) 
{
    $categoryIds[]=$row;
}

foreach($categoryIds as $entity_id)
{
    $fieldset->addField($entity_id['colorcode'], 'checkbox', array(
    'label'     => Mage::helper('selectcolorforimage')->__($entity_id['colorcode']),
    'name'      =>'assign_color_new[]',
    'values'    =>'not set vaqlue',
  ));
}

0 个答案:

没有答案