Save Button Redirecting to Same Admin Form in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?uiComponent Form Save Button Not workingMagento 2 : Problem while adding custom button order view page?Magento 2: How to override newsletter Subscriber modelWhy Getting categories and names on product view page Magento 2 fails?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 Add new field to Magento_User admin formMagento offline custom Payment method with drop down listMagento 2 Create dynamic array From different Model Collection to use in multi select in gridMagento 2.2.5: Overriding Admin Controller sales/orderI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Magento 2.3 Can't view module's front end page output?

Why is a lens darker than other ones when applying the same settings?

Nose gear failure in single prop aircraft: belly landing or nose-gear up landing?

What is the difference between a "ranged attack" and a "ranged weapon attack"?

Are the endpoints of the domain of a function counted as critical points?

How do living politicians protect their readily obtainable signatures from misuse?

What does 丫 mean? 丫是什么意思?

The test team as an enemy of development? And how can this be avoided?

Google .dev domain strangely redirects to https

Monty Hall Problem-Probability Paradox

The Nth Gryphon Number

Test print coming out spongy

Can you force honesty by using the Speak with Dead and Zone of Truth spells together?

New Order #6: Easter Egg

What is the chair depicted in Cesare Maccari's 1889 painting "Cicerone denuncia Catilina"?

Resize vertical bars (absolute-value symbols)

How does light 'choose' between wave and particle behaviour?

Is multiple magic items in one inherently imbalanced?

two integers one line calculator

Can two person see the same photon?

What does Turing mean by this statement?

Why is it faster to reheat something than it is to cook it?

What does it mean that physics no longer uses mechanical models to describe phenomena?

How to force a browser when connecting to a specific domain to be https only using only the client machine?

Would color changing eyes affect vision?



Save Button Redirecting to Same Admin Form in Magento 2



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?uiComponent Form Save Button Not workingMagento 2 : Problem while adding custom button order view page?Magento 2: How to override newsletter Subscriber modelWhy Getting categories and names on product view page Magento 2 fails?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 Add new field to Magento_User admin formMagento offline custom Payment method with drop down listMagento 2 Create dynamic array From different Model Collection to use in multi select in gridMagento 2.2.5: Overriding Admin Controller sales/orderI have created one field using product form field for my price i want save my field value at product creation time from backend magento2Magento 2.3 Can't view module's front end page output?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I am working on a custom module in magneto 2. i am creating an admin form using UI Component, when i click on save button Page redirects to its self




VendorModuleBlockAdminhtmlProductSlidersEditSaveButton




use MagentoFrameworkViewElementUiComponentControl

ButtonProviderInterface;

/**
* Class SaveButton
* @package MagentoCustomerBlockAdminhtmlEdit
*/
class SaveButton extends GenericButton implements ButtonProviderInterface

/**
* @return array
*/
public function getButtonData()

return [
'label' => __('Save'),
'class' => 'save primary',
'data_attribute' => [
'mage-init' => ['button' => ['event' => 'save']],
'form-role' => 'save',
],
'sort_order' => 90,
];




i have make buttons using Block here is my Edit.php Class




VendorModuleBlockAdminhtmlProductSlidersEdit




class Edit extends MagentoBackendBlockWidgetFormContainer


protected $_coreRegistry = null;


public function __construct(
MagentoBackendBlockWidgetContext $context,
MagentoFrameworkRegistry $registry,
array $data = []
)
$this->_coreRegistry = $registry;
parent::__construct($context, $data);



protected function _construct()

$this->_objectId = 'slider_id';
$this->_blockGroup = 'FME_ProductSliders';
$this->_controller = 'adminhtml_productsliders';
parent::_construct();

if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
$this->buttonList->update('save', 'label', __('Save'));
$this->buttonList->add(
'saveandcontinue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
],
]
],
-100
);
else
$this->buttonList->remove('save');


if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
$this->buttonList->update('delete', 'label', __('Delete'));
else
$this->buttonList->remove('delete');





/**
* Retrieve text for header element depending on loaded page
*
* @return string
*/
public function getHeaderText()


if ($this->_coreRegistry->registry('fme_productsliders')->getId())
return __(
"Edit Sliders '%1'",
$this->escapeHtml($this->_coreRegistry->registry('fme_productsliders')->getTitle())
);
else
return __('New Sliders');



/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
public function _isAllowedAction($resourceId)

return $this->_authorization->isAllowed($resourceId);


/**
* Getter of url for "Save and Continue" button
* tab_id will be replaced by desired by JS later
*
* @return string
*/


public function _getSaveAndContinueUrl()


return $this->getUrl(
'fme_productsliders/*/save',
['_current' => true,
'back' => 'edit',
'active_tab' => 'tab_id']
);



/**
* Prepare layout
*
* @return MagentoFrameworkViewElementAbstractBlock
*/
protected function _prepareLayout()

$this->_formScripts[] = "
function toggleEditor()
if (tinyMCE.getInstanceById('overview') == null)
tinyMCE.execCommand('mceAddControl', false, 'overview');
else
tinyMCE.execCommand('mceRemoveControl', false, 'overview');

;
";
return parent::_prepareLayout();




Here is my save.php controller




VendorModuleControllerAdminhtmlModule;




class Save extends MagentoBackendAppAction

var $sliderFactory;


public function __construct(
MagentoBackendAppActionContext $context,
FMEProductSlidersModelProductSlidersFactory $sliderFactory
)
parent::__construct($context);
$this->sliderFactory = $sliderFactory;



public function execute()

$data = $this->getRequest()->getPostValue();
if (!$data)

$this->_redirect('fme_productsliders/productsliders/edit');
return;

try
$rowData = $this->sliderFactory->create();
$rowData->setData($data);
if (isset($data['slider_id']))
$rowData->setEntityId($data['slider_id']);

$rowData->save();
$this->messageManager->addSuccess(__('Row data has been successfully saved.'));
catch (Exception $e)
$this->messageManager->addError(__($e->getMessage()));

$this->_redirect('fme_productsliders/productsliders/index');


/**
* @return bool
*/
protected function _isAllowed()

return $this->_authorization->isAllowed('FME_ProductSliders::save');




i Need a Help if anyone can??










share|improve this question









New contributor




Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    2















    I am working on a custom module in magneto 2. i am creating an admin form using UI Component, when i click on save button Page redirects to its self




    VendorModuleBlockAdminhtmlProductSlidersEditSaveButton




    use MagentoFrameworkViewElementUiComponentControl

    ButtonProviderInterface;

    /**
    * Class SaveButton
    * @package MagentoCustomerBlockAdminhtmlEdit
    */
    class SaveButton extends GenericButton implements ButtonProviderInterface

    /**
    * @return array
    */
    public function getButtonData()

    return [
    'label' => __('Save'),
    'class' => 'save primary',
    'data_attribute' => [
    'mage-init' => ['button' => ['event' => 'save']],
    'form-role' => 'save',
    ],
    'sort_order' => 90,
    ];




    i have make buttons using Block here is my Edit.php Class




    VendorModuleBlockAdminhtmlProductSlidersEdit




    class Edit extends MagentoBackendBlockWidgetFormContainer


    protected $_coreRegistry = null;


    public function __construct(
    MagentoBackendBlockWidgetContext $context,
    MagentoFrameworkRegistry $registry,
    array $data = []
    )
    $this->_coreRegistry = $registry;
    parent::__construct($context, $data);



    protected function _construct()

    $this->_objectId = 'slider_id';
    $this->_blockGroup = 'FME_ProductSliders';
    $this->_controller = 'adminhtml_productsliders';
    parent::_construct();

    if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
    $this->buttonList->update('save', 'label', __('Save'));
    $this->buttonList->add(
    'saveandcontinue',
    [
    'label' => __('Save and Continue Edit'),
    'class' => 'save',
    'data_attribute' => [
    'mage-init' => [
    'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
    ],
    ]
    ],
    -100
    );
    else
    $this->buttonList->remove('save');


    if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
    $this->buttonList->update('delete', 'label', __('Delete'));
    else
    $this->buttonList->remove('delete');





    /**
    * Retrieve text for header element depending on loaded page
    *
    * @return string
    */
    public function getHeaderText()


    if ($this->_coreRegistry->registry('fme_productsliders')->getId())
    return __(
    "Edit Sliders '%1'",
    $this->escapeHtml($this->_coreRegistry->registry('fme_productsliders')->getTitle())
    );
    else
    return __('New Sliders');



    /**
    * Check permission for passed action
    *
    * @param string $resourceId
    * @return bool
    */
    public function _isAllowedAction($resourceId)

    return $this->_authorization->isAllowed($resourceId);


    /**
    * Getter of url for "Save and Continue" button
    * tab_id will be replaced by desired by JS later
    *
    * @return string
    */


    public function _getSaveAndContinueUrl()


    return $this->getUrl(
    'fme_productsliders/*/save',
    ['_current' => true,
    'back' => 'edit',
    'active_tab' => 'tab_id']
    );



    /**
    * Prepare layout
    *
    * @return MagentoFrameworkViewElementAbstractBlock
    */
    protected function _prepareLayout()

    $this->_formScripts[] = "
    function toggleEditor()
    if (tinyMCE.getInstanceById('overview') == null)
    tinyMCE.execCommand('mceAddControl', false, 'overview');
    else
    tinyMCE.execCommand('mceRemoveControl', false, 'overview');

    ;
    ";
    return parent::_prepareLayout();




    Here is my save.php controller




    VendorModuleControllerAdminhtmlModule;




    class Save extends MagentoBackendAppAction

    var $sliderFactory;


    public function __construct(
    MagentoBackendAppActionContext $context,
    FMEProductSlidersModelProductSlidersFactory $sliderFactory
    )
    parent::__construct($context);
    $this->sliderFactory = $sliderFactory;



    public function execute()

    $data = $this->getRequest()->getPostValue();
    if (!$data)

    $this->_redirect('fme_productsliders/productsliders/edit');
    return;

    try
    $rowData = $this->sliderFactory->create();
    $rowData->setData($data);
    if (isset($data['slider_id']))
    $rowData->setEntityId($data['slider_id']);

    $rowData->save();
    $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
    catch (Exception $e)
    $this->messageManager->addError(__($e->getMessage()));

    $this->_redirect('fme_productsliders/productsliders/index');


    /**
    * @return bool
    */
    protected function _isAllowed()

    return $this->_authorization->isAllowed('FME_ProductSliders::save');




    i Need a Help if anyone can??










    share|improve this question









    New contributor




    Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      2












      2








      2








      I am working on a custom module in magneto 2. i am creating an admin form using UI Component, when i click on save button Page redirects to its self




      VendorModuleBlockAdminhtmlProductSlidersEditSaveButton




      use MagentoFrameworkViewElementUiComponentControl

      ButtonProviderInterface;

      /**
      * Class SaveButton
      * @package MagentoCustomerBlockAdminhtmlEdit
      */
      class SaveButton extends GenericButton implements ButtonProviderInterface

      /**
      * @return array
      */
      public function getButtonData()

      return [
      'label' => __('Save'),
      'class' => 'save primary',
      'data_attribute' => [
      'mage-init' => ['button' => ['event' => 'save']],
      'form-role' => 'save',
      ],
      'sort_order' => 90,
      ];




      i have make buttons using Block here is my Edit.php Class




      VendorModuleBlockAdminhtmlProductSlidersEdit




      class Edit extends MagentoBackendBlockWidgetFormContainer


      protected $_coreRegistry = null;


      public function __construct(
      MagentoBackendBlockWidgetContext $context,
      MagentoFrameworkRegistry $registry,
      array $data = []
      )
      $this->_coreRegistry = $registry;
      parent::__construct($context, $data);



      protected function _construct()

      $this->_objectId = 'slider_id';
      $this->_blockGroup = 'FME_ProductSliders';
      $this->_controller = 'adminhtml_productsliders';
      parent::_construct();

      if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
      $this->buttonList->update('save', 'label', __('Save'));
      $this->buttonList->add(
      'saveandcontinue',
      [
      'label' => __('Save and Continue Edit'),
      'class' => 'save',
      'data_attribute' => [
      'mage-init' => [
      'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
      ],
      ]
      ],
      -100
      );
      else
      $this->buttonList->remove('save');


      if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
      $this->buttonList->update('delete', 'label', __('Delete'));
      else
      $this->buttonList->remove('delete');





      /**
      * Retrieve text for header element depending on loaded page
      *
      * @return string
      */
      public function getHeaderText()


      if ($this->_coreRegistry->registry('fme_productsliders')->getId())
      return __(
      "Edit Sliders '%1'",
      $this->escapeHtml($this->_coreRegistry->registry('fme_productsliders')->getTitle())
      );
      else
      return __('New Sliders');



      /**
      * Check permission for passed action
      *
      * @param string $resourceId
      * @return bool
      */
      public function _isAllowedAction($resourceId)

      return $this->_authorization->isAllowed($resourceId);


      /**
      * Getter of url for "Save and Continue" button
      * tab_id will be replaced by desired by JS later
      *
      * @return string
      */


      public function _getSaveAndContinueUrl()


      return $this->getUrl(
      'fme_productsliders/*/save',
      ['_current' => true,
      'back' => 'edit',
      'active_tab' => 'tab_id']
      );



      /**
      * Prepare layout
      *
      * @return MagentoFrameworkViewElementAbstractBlock
      */
      protected function _prepareLayout()

      $this->_formScripts[] = "
      function toggleEditor()
      if (tinyMCE.getInstanceById('overview') == null)
      tinyMCE.execCommand('mceAddControl', false, 'overview');
      else
      tinyMCE.execCommand('mceRemoveControl', false, 'overview');

      ;
      ";
      return parent::_prepareLayout();




      Here is my save.php controller




      VendorModuleControllerAdminhtmlModule;




      class Save extends MagentoBackendAppAction

      var $sliderFactory;


      public function __construct(
      MagentoBackendAppActionContext $context,
      FMEProductSlidersModelProductSlidersFactory $sliderFactory
      )
      parent::__construct($context);
      $this->sliderFactory = $sliderFactory;



      public function execute()

      $data = $this->getRequest()->getPostValue();
      if (!$data)

      $this->_redirect('fme_productsliders/productsliders/edit');
      return;

      try
      $rowData = $this->sliderFactory->create();
      $rowData->setData($data);
      if (isset($data['slider_id']))
      $rowData->setEntityId($data['slider_id']);

      $rowData->save();
      $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
      catch (Exception $e)
      $this->messageManager->addError(__($e->getMessage()));

      $this->_redirect('fme_productsliders/productsliders/index');


      /**
      * @return bool
      */
      protected function _isAllowed()

      return $this->_authorization->isAllowed('FME_ProductSliders::save');




      i Need a Help if anyone can??










      share|improve this question









      New contributor




      Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I am working on a custom module in magneto 2. i am creating an admin form using UI Component, when i click on save button Page redirects to its self




      VendorModuleBlockAdminhtmlProductSlidersEditSaveButton




      use MagentoFrameworkViewElementUiComponentControl

      ButtonProviderInterface;

      /**
      * Class SaveButton
      * @package MagentoCustomerBlockAdminhtmlEdit
      */
      class SaveButton extends GenericButton implements ButtonProviderInterface

      /**
      * @return array
      */
      public function getButtonData()

      return [
      'label' => __('Save'),
      'class' => 'save primary',
      'data_attribute' => [
      'mage-init' => ['button' => ['event' => 'save']],
      'form-role' => 'save',
      ],
      'sort_order' => 90,
      ];




      i have make buttons using Block here is my Edit.php Class




      VendorModuleBlockAdminhtmlProductSlidersEdit




      class Edit extends MagentoBackendBlockWidgetFormContainer


      protected $_coreRegistry = null;


      public function __construct(
      MagentoBackendBlockWidgetContext $context,
      MagentoFrameworkRegistry $registry,
      array $data = []
      )
      $this->_coreRegistry = $registry;
      parent::__construct($context, $data);



      protected function _construct()

      $this->_objectId = 'slider_id';
      $this->_blockGroup = 'FME_ProductSliders';
      $this->_controller = 'adminhtml_productsliders';
      parent::_construct();

      if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
      $this->buttonList->update('save', 'label', __('Save'));
      $this->buttonList->add(
      'saveandcontinue',
      [
      'label' => __('Save and Continue Edit'),
      'class' => 'save',
      'data_attribute' => [
      'mage-init' => [
      'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
      ],
      ]
      ],
      -100
      );
      else
      $this->buttonList->remove('save');


      if ($this->_isAllowedAction('FME_ProductSliders::productsliders'))
      $this->buttonList->update('delete', 'label', __('Delete'));
      else
      $this->buttonList->remove('delete');





      /**
      * Retrieve text for header element depending on loaded page
      *
      * @return string
      */
      public function getHeaderText()


      if ($this->_coreRegistry->registry('fme_productsliders')->getId())
      return __(
      "Edit Sliders '%1'",
      $this->escapeHtml($this->_coreRegistry->registry('fme_productsliders')->getTitle())
      );
      else
      return __('New Sliders');



      /**
      * Check permission for passed action
      *
      * @param string $resourceId
      * @return bool
      */
      public function _isAllowedAction($resourceId)

      return $this->_authorization->isAllowed($resourceId);


      /**
      * Getter of url for "Save and Continue" button
      * tab_id will be replaced by desired by JS later
      *
      * @return string
      */


      public function _getSaveAndContinueUrl()


      return $this->getUrl(
      'fme_productsliders/*/save',
      ['_current' => true,
      'back' => 'edit',
      'active_tab' => 'tab_id']
      );



      /**
      * Prepare layout
      *
      * @return MagentoFrameworkViewElementAbstractBlock
      */
      protected function _prepareLayout()

      $this->_formScripts[] = "
      function toggleEditor()
      if (tinyMCE.getInstanceById('overview') == null)
      tinyMCE.execCommand('mceAddControl', false, 'overview');
      else
      tinyMCE.execCommand('mceRemoveControl', false, 'overview');

      ;
      ";
      return parent::_prepareLayout();




      Here is my save.php controller




      VendorModuleControllerAdminhtmlModule;




      class Save extends MagentoBackendAppAction

      var $sliderFactory;


      public function __construct(
      MagentoBackendAppActionContext $context,
      FMEProductSlidersModelProductSlidersFactory $sliderFactory
      )
      parent::__construct($context);
      $this->sliderFactory = $sliderFactory;



      public function execute()

      $data = $this->getRequest()->getPostValue();
      if (!$data)

      $this->_redirect('fme_productsliders/productsliders/edit');
      return;

      try
      $rowData = $this->sliderFactory->create();
      $rowData->setData($data);
      if (isset($data['slider_id']))
      $rowData->setEntityId($data['slider_id']);

      $rowData->save();
      $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
      catch (Exception $e)
      $this->messageManager->addError(__($e->getMessage()));

      $this->_redirect('fme_productsliders/productsliders/index');


      /**
      * @return bool
      */
      protected function _isAllowed()

      return $this->_authorization->isAllowed('FME_ProductSliders::save');




      i Need a Help if anyone can??







      magento2 database magento2.3 php-7






      share|improve this question









      New contributor




      Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Apr 17 at 5:07







      Waqar Ali













      New contributor




      Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Apr 16 at 13:10









      Waqar AliWaqar Ali

      186




      186




      New contributor




      Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Waqar Ali is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          0














          You can try to set current to false



          public function _getSaveAndContinueUrl()


          return $this->getUrl(
          'fme_productsliders/*/save',
          ['_current' => false,
          'back' => 'edit',
          'active_tab' => 'tab_id']
          );



          Update: Add a return in execute method



          public function execute()

          $data = $this->getRequest()->getPostValue();
          if (!$data)

          $this->_redirect('fme_productsliders/productsliders/edit');
          return;

          try
          $rowData = $this->sliderFactory->create();
          $rowData->setData($data);
          if (isset($data['slider_id']))
          $rowData->setEntityId($data['slider_id']);

          $rowData->save();
          $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
          catch (Exception $e)
          $this->messageManager->addError(__($e->getMessage()));

          return $this->_redirect('fme_productsliders/productsliders/index');






          share|improve this answer

























          • not working how can i check this method is called not not

            – Waqar Ali
            Apr 17 at 5:22











          • @WaqarAli updated the answer please check

            – magefms
            Apr 17 at 5:49











          • Thank you foyour help but i solved problem by adding <item name="save" xsi:type="array"> <item name="name" xsi:type="string">save</item> <item name="label" xsi:type="string" translate="true">save</item> <item name="class" xsi:type="string">primary</item> </item>

            – Waqar Ali
            Apr 17 at 12:13






          • 1





            i got help from [magento.stackexchange.com/questions/139639/…

            – Waqar Ali
            Apr 17 at 12:15











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Waqar Ali is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270333%2fsave-button-redirecting-to-same-admin-form-in-magento-2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You can try to set current to false



          public function _getSaveAndContinueUrl()


          return $this->getUrl(
          'fme_productsliders/*/save',
          ['_current' => false,
          'back' => 'edit',
          'active_tab' => 'tab_id']
          );



          Update: Add a return in execute method



          public function execute()

          $data = $this->getRequest()->getPostValue();
          if (!$data)

          $this->_redirect('fme_productsliders/productsliders/edit');
          return;

          try
          $rowData = $this->sliderFactory->create();
          $rowData->setData($data);
          if (isset($data['slider_id']))
          $rowData->setEntityId($data['slider_id']);

          $rowData->save();
          $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
          catch (Exception $e)
          $this->messageManager->addError(__($e->getMessage()));

          return $this->_redirect('fme_productsliders/productsliders/index');






          share|improve this answer

























          • not working how can i check this method is called not not

            – Waqar Ali
            Apr 17 at 5:22











          • @WaqarAli updated the answer please check

            – magefms
            Apr 17 at 5:49











          • Thank you foyour help but i solved problem by adding <item name="save" xsi:type="array"> <item name="name" xsi:type="string">save</item> <item name="label" xsi:type="string" translate="true">save</item> <item name="class" xsi:type="string">primary</item> </item>

            – Waqar Ali
            Apr 17 at 12:13






          • 1





            i got help from [magento.stackexchange.com/questions/139639/…

            – Waqar Ali
            Apr 17 at 12:15















          0














          You can try to set current to false



          public function _getSaveAndContinueUrl()


          return $this->getUrl(
          'fme_productsliders/*/save',
          ['_current' => false,
          'back' => 'edit',
          'active_tab' => 'tab_id']
          );



          Update: Add a return in execute method



          public function execute()

          $data = $this->getRequest()->getPostValue();
          if (!$data)

          $this->_redirect('fme_productsliders/productsliders/edit');
          return;

          try
          $rowData = $this->sliderFactory->create();
          $rowData->setData($data);
          if (isset($data['slider_id']))
          $rowData->setEntityId($data['slider_id']);

          $rowData->save();
          $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
          catch (Exception $e)
          $this->messageManager->addError(__($e->getMessage()));

          return $this->_redirect('fme_productsliders/productsliders/index');






          share|improve this answer

























          • not working how can i check this method is called not not

            – Waqar Ali
            Apr 17 at 5:22











          • @WaqarAli updated the answer please check

            – magefms
            Apr 17 at 5:49











          • Thank you foyour help but i solved problem by adding <item name="save" xsi:type="array"> <item name="name" xsi:type="string">save</item> <item name="label" xsi:type="string" translate="true">save</item> <item name="class" xsi:type="string">primary</item> </item>

            – Waqar Ali
            Apr 17 at 12:13






          • 1





            i got help from [magento.stackexchange.com/questions/139639/…

            – Waqar Ali
            Apr 17 at 12:15













          0












          0








          0







          You can try to set current to false



          public function _getSaveAndContinueUrl()


          return $this->getUrl(
          'fme_productsliders/*/save',
          ['_current' => false,
          'back' => 'edit',
          'active_tab' => 'tab_id']
          );



          Update: Add a return in execute method



          public function execute()

          $data = $this->getRequest()->getPostValue();
          if (!$data)

          $this->_redirect('fme_productsliders/productsliders/edit');
          return;

          try
          $rowData = $this->sliderFactory->create();
          $rowData->setData($data);
          if (isset($data['slider_id']))
          $rowData->setEntityId($data['slider_id']);

          $rowData->save();
          $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
          catch (Exception $e)
          $this->messageManager->addError(__($e->getMessage()));

          return $this->_redirect('fme_productsliders/productsliders/index');






          share|improve this answer















          You can try to set current to false



          public function _getSaveAndContinueUrl()


          return $this->getUrl(
          'fme_productsliders/*/save',
          ['_current' => false,
          'back' => 'edit',
          'active_tab' => 'tab_id']
          );



          Update: Add a return in execute method



          public function execute()

          $data = $this->getRequest()->getPostValue();
          if (!$data)

          $this->_redirect('fme_productsliders/productsliders/edit');
          return;

          try
          $rowData = $this->sliderFactory->create();
          $rowData->setData($data);
          if (isset($data['slider_id']))
          $rowData->setEntityId($data['slider_id']);

          $rowData->save();
          $this->messageManager->addSuccess(__('Row data has been successfully saved.'));
          catch (Exception $e)
          $this->messageManager->addError(__($e->getMessage()));

          return $this->_redirect('fme_productsliders/productsliders/index');







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 17 at 5:49

























          answered Apr 16 at 13:48









          magefmsmagefms

          2,8052528




          2,8052528












          • not working how can i check this method is called not not

            – Waqar Ali
            Apr 17 at 5:22











          • @WaqarAli updated the answer please check

            – magefms
            Apr 17 at 5:49











          • Thank you foyour help but i solved problem by adding <item name="save" xsi:type="array"> <item name="name" xsi:type="string">save</item> <item name="label" xsi:type="string" translate="true">save</item> <item name="class" xsi:type="string">primary</item> </item>

            – Waqar Ali
            Apr 17 at 12:13






          • 1





            i got help from [magento.stackexchange.com/questions/139639/…

            – Waqar Ali
            Apr 17 at 12:15

















          • not working how can i check this method is called not not

            – Waqar Ali
            Apr 17 at 5:22











          • @WaqarAli updated the answer please check

            – magefms
            Apr 17 at 5:49











          • Thank you foyour help but i solved problem by adding <item name="save" xsi:type="array"> <item name="name" xsi:type="string">save</item> <item name="label" xsi:type="string" translate="true">save</item> <item name="class" xsi:type="string">primary</item> </item>

            – Waqar Ali
            Apr 17 at 12:13






          • 1





            i got help from [magento.stackexchange.com/questions/139639/…

            – Waqar Ali
            Apr 17 at 12:15
















          not working how can i check this method is called not not

          – Waqar Ali
          Apr 17 at 5:22





          not working how can i check this method is called not not

          – Waqar Ali
          Apr 17 at 5:22













          @WaqarAli updated the answer please check

          – magefms
          Apr 17 at 5:49





          @WaqarAli updated the answer please check

          – magefms
          Apr 17 at 5:49













          Thank you foyour help but i solved problem by adding <item name="save" xsi:type="array"> <item name="name" xsi:type="string">save</item> <item name="label" xsi:type="string" translate="true">save</item> <item name="class" xsi:type="string">primary</item> </item>

          – Waqar Ali
          Apr 17 at 12:13





          Thank you foyour help but i solved problem by adding <item name="save" xsi:type="array"> <item name="name" xsi:type="string">save</item> <item name="label" xsi:type="string" translate="true">save</item> <item name="class" xsi:type="string">primary</item> </item>

          – Waqar Ali
          Apr 17 at 12:13




          1




          1





          i got help from [magento.stackexchange.com/questions/139639/…

          – Waqar Ali
          Apr 17 at 12:15





          i got help from [magento.stackexchange.com/questions/139639/…

          – Waqar Ali
          Apr 17 at 12:15










          Waqar Ali is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          Waqar Ali is a new contributor. Be nice, and check out our Code of Conduct.












          Waqar Ali is a new contributor. Be nice, and check out our Code of Conduct.











          Waqar Ali is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270333%2fsave-button-redirecting-to-same-admin-form-in-magento-2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Sum ergo cogito? 1 nng

          419 nièngy_Soadمي 19bal1.5o_g

          Queiggey Chernihivv 9NnOo i Zw X QqKk LpB