system.xml magento中的Onchange事件

时间:2012-12-10 09:05:43

标签: magento

任何人都可以告诉我如何做到这一点。我用system.xml创建了自定义模块。在system.xml中我创建了两个元素,一个选择选项和另一个文本框。我想在特定值上显示文本框选择选项。我的代码是: 选择选项

<email_sender translate="label">
  <label>E-mail Sender</label>
  <frontend_type>select</frontend_type>
  <source_model>adminhtml/system_config_source_email_identity</source_model>
  <sort_order>0</sort_order>
  <show_in_default>1</show_in_default>
  <show_in_website>1</show_in_website>
  <show_in_store>1</show_in_store>
</email_sender>

想要在选择选项上显示的文本框是:

<interval translate="label">
  <label>Interval</label>
  <frontend_type>text</frontend_type>
  <sort_order>4</sort_order>
  <show_in_default>1</show_in_default>
  <show_in_website>1</show_in_website>
  <show_in_store>1</show_in_store>

。 而对于select我在模型中使用这段代码

public function toOptionArray()
{
    return array(
        array('value'=>'show_txtbx', 'label'=>Mage::helper('mymodule')->__('Show Textbox')),
        array('value'=>'hide', 'label'=>Mage::helper('mymodule')->__('Hide')),

    );
}

我怎么能这样做。谢谢。

1 个答案:

答案 0 :(得分:0)

大家,我得到了一些额外的搜索后得到了答案。感谢Alan提供了很好的教程。这是我得到答案的链接。Click Here