Question

I am working on a new Magento extension, in my Adminhtml form I want to add the button "saveAndContinueEdit"

I've added this code to my Edit.php file.

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

But whene I click on it, I have this JavaScript error :

Erreur : ReferenceError: saveAndContinueEdit is not defined Fichier Source : http://X.X.X.X/magento/index.php/slider/adminhtml_config/new/key

Can you help me ?
Thanks

Was it helpful?

Solution

in your admin Block Constructor Put these lines.

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

Please remember you have to write functionality for it in PHP also. Now in you action just have a final check that if you are getting back as param .. redirect it to referer page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top