我正在创建一个管理模块。我有一组字段,我想在系统配置中创建一个3个字段的字段集,我已经创建了字段但是想在其中添加字段集。 任何帮助,将不胜感激。谢谢
答案 0 :(得分:0)
您没有提供太多信息,例如模块的布局,是否在代码或.phtml中添加字段,但这就是我在字段集中添加字段的方式:
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('form_settings', array('legend'=>Mage::helper('mymodule')->__('Module Settings')));
$newFieldset = $fieldset->addFieldset('form_settings_test', array('legend'=>Mage::helper('khaosconnect')->__('Order Settings')));
$newFieldset->addField('mysetting1', 'text', array(
'label' => Mage::helper('mymodule')->__('Setting 1'),
'class' => 'required-entry',
'required' => true,
'name' => 'mysetting1',
'value' => "val1",
'style' => 'width:500px'
));
$newFieldset->addField('mysetting2', 'text', array(
'label' => Mage::helper('mymodule')->__('Setting 2'),
'class' => 'required-entry',
'required' => true,
'name' => 'mysetting2',
'value' => "val2",
'style' => 'width:500px'
));
}
编辑:已更新以显示嵌套字段集。