First of all I have already seen this question can a magento adminhtml field depend on more then one field or value? It talks about System/Configuration fields, which is not what I am looking for.
I am trying to create a form in the magento backend. I have a dropdown Dropdown with values 1, 2 and 3. I need the field X to be displayed when I select 1 or 2. How do I do this ?
I am able to display X depending on a single value of the dropdown, not for multiple values.
This is how I have done:
$this->setChild('form_after',$this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
->addFieldMap($X->getHtmlId(), $Xl->getName())
->addFieldMap($dropdown->getHtmlId(), $dropdown->getName())
->addFieldDependence($X->getName(), $dropdown->getName(), 1)
);
Where $x
and $dropdown
are variables which stores addField()
result