我的代码:
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset("tuition_form", array("legend"=>Mage::helper("tuition")->__("Student information")));
$fieldset->addField("secondary", "multiselect", array(
"class" => "required-entry",
"required" => true,
"name"=> "subject[secondary]",
'values' => Example_Tuition_Block_Adminhtml_Student_Grid::getValueArray34(),
));
$fieldset->addField("others", "text", array(
"class" => "required-entry",
"required" => true,
"name"=> "subject[others]",
));
$this->setForm($form);
$this->setChild('form_after',
// The content of the "form_after" block is a Mage_Adminhtml_Block_Widget_Form_Element_Dependence block typ
$this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
->addFieldMap('junior', 'junior')
->addFieldMap('others', 'others')
->addFieldDependence('others', 'junior', 'chinese')
);
return parent::_prepareForm();
}
我的多次下拉
这里如果我选择中文我想要文本字段.如果我选择中文,马来文,...等比我得到文本框但当我也选择物理或科学时,我没有得到文本框如何解决这个问题?
最新回答
- 2019-12-51 #
这里使用的是 javascript 我可以显示或隐藏不使用依赖项的文本框:
使用此功能,我可以在更改多个下拉列表时显示和隐藏文本框。