2015-07-10 68 views
2

是否有可能創建一個表單(在後端自定義選項卡中),其中包含兩個下拉字段,第二個字段依賴於第一個值及其值也依賴於從第一場的選擇。Magento:管理 - 具有依賴關係規則和動態值的動態表單

下面的例子:

[Attributes] <-- 'Select' field with all Attributes 
[Values]  <-- 'Select' field with all Values of selected Attribute in above field 
+0

檢查此鏈接http://www.atwix.com/magento/fields-dependency-in-magento-admin-forms/ –

+0

謝謝。這涵蓋了依賴規則。但我仍然不知道如何獲得第二個領域的動態值。 – mpfmon

回答

0

您可以使用after_element_html鍵添加自定義的HTML或JavaScript。

$fieldset->addField("xxx", "text", array(
       "label" => Mage::helper("xxx")->__("Field"), 
       "name" => "xxx", 
       "class" =>"validate-number", 
       "after_element_html"=>"<script>your javascript code here</script>" 
      ));