$fieldset->addField('auto_play','select',
array('label'=>Mage::helper('attigo_slider')->__('Auto Play'),
'values'=>Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray(),
'name'=>'auto_play',
'value'=> $config['auto_play']));
现在我想根据选定的上限值
添加以下文本框$fieldset->addField('delay', 'text',
array('label'=> Mage::helper('attigo_slider')->__('Delay Speed'),
'after_element_html'=>'<small>Work only if Auto play is set to "Yes"</small>',
'name'=>'delay','value'=> $config['delay']));
答案 0 :(得分:1)
你可以使用如下
$fldSet4->addField('include_flag', 'select', array(
'label' => $hlp->__('Include Only Selected Categories'),
'name' => 'include_flag',
'values' => $yesno
));
// drop down if yes then show below text box
$fldSet4->addField('include_only', 'text', array(
'label' => $hlp->__('Include Only Categories'),
'name' => 'include_only',
'note' => $hlp->__('Comma separated list of the categories IDs like 17,4,25'),
));
// Append dependency javascript
$this->setChild('form_after', $this->getLayout()
->createBlock('adminhtml/widget_form_element_dependence')
->addFieldMap('include_flag', 'include_flag')
->addFieldMap('include_only', 'include_only')
->addFieldDependence('include_only', 'include_flag', 1) // 2 = 'Specified'
);
修改强>
$this->setChild('form_after', $this->getLayout()
->createBlock('adminhtml/widget_form_element_dependence')
->addFieldMap('auto_play', 'auto_play')
->addFieldMap('delay', 'delay')
->addFieldDependence('delay', 'auto_play', 1) // 2 = 'Specified'
);
根据需要更改->addFieldDependence
函数的第3个参数。
尽量仔细理解。
希望这对您有所帮助。