Magento form field dependence

piaoling  2012-12-28 10:18:09

file : app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Edit/Tab/Main.php

// define field dependencies
        $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
            ->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')//param1 is form element id, param2 is element maped
            ->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')
            ->addFieldMap("frontend_input", 'frontend_input_type')
            ->addFieldDependence('wysiwyg_enabled', 'frontend_input_type', 'textarea')//param1 and parma2 is mapped element not element id, element 1 is displayed according to element2's value is param3
            ->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0')

        );
类别 :  magento(258)  |  浏览(5376)  |  评论(0)
发表评论(评论将通过邮件发给作者):

Email: