如何在表单中添加SaveandContinueEdit按钮?

t.c*_*t.c 2 javascript forms magento adminhtml

我正在制作一个新的Magento扩展,在我的Adminhtml表单中我想添加按钮"saveAndContinueEdit"

我已将此代码添加到Edit.php文件中.

      $this->_addButton('saveandcontinue', array(
    'label'     => Mage::helper('adminhtml')->__('Save And Continue Edit'),
    'onclick'   => 'saveAndContinueEdit()',
    'class'     => 'save',
), -100);
Run Code Online (Sandbox Code Playgroud)

但是,当我点击它时,我有这个JavaScript错误:

Erreur:ReferenceError:saveAndContinueEdit未定义Fichier来源: http://XXXX/magento/index.php/slider/adminhtml_config/new/key

你能帮助我吗 ?
谢谢

ank*_*ngh 13

在您的管理员块构造函数中放置这些行.

$this->_formScripts[] = " function saveAndContinueEdit(){
            editForm.submit($('edit_form').action+'back/edit/');
        }
    ";
Run Code Online (Sandbox Code Playgroud)

请记住,你也必须在PHP中编写它的功能.现在在你的行动中,只需要进行最后的检查,如果你回来作为参数...将其重定向到referer页面.