module method postProcess() doesn't redict to admin page

postProcess is well fired when I click on the save button of the helperForm from page, but instead of going back to my module admin page, the user stay on the edit page

public function postProcess()
{
    if (Tools::isSubmit('submitTest')) {
        //Entries here works well when the helperform is send

        return; //The admin user stays on edit page instead of going back to my module config page
    }

    return false;
}

public function getContent()
{
    if(Tools::isSubmit('updatemyModule') || Tools::isSubmit('submitTest')) {
        return $this->postProcess().$this->renderForm();
    }
    else {
        return $this->listform();
    }
}

1 answer

  • answered 2021-04-21 15:18 Richard

    Since token is checked by the main class, I simply put a call to the listform method at the end of the postProcess function

    public function postProcess()
    {
    if (Tools::isSubmit('submitTest')) {
        //Entries here works well when the helperform is send
    
        return $this->listform(); //reset the context states so it goes back to mymodule config page
    }
    
    return false;
    }