Redirect Target for the controller October 27, 2020, 04:17:52 AM It would be nice if the controller would take a parameter that tells it where to redirect after some operation for example adding a record. For example if you have a contacts / add page and you want the controller to redirect you to accounts/view page after the add then the controller would take a parameter like redirect=accounts/view or something.Rich Quote Selected
Re: Redirect Target for the controller Reply #1 – October 28, 2020, 08:57:39 AM @rwebb have you looked at the View Hepler in phprad? You would see that there is a redirect function there, which you can redirect to pages after performing your action. Quote Selected
Re: Redirect Target for the controller Reply #2 – October 28, 2020, 03:19:22 PM Is there any documentation on this feature? Quote Selected
Re: Redirect Target for the controller Reply #3 – October 28, 2020, 04:06:18 PM @rwebb here is the documentation https://phprad.com/info/api#global-function-helperredirect_to_page($path=null);exit;Convinient Function To Redirect to Another PageExample : Code: [Select]redirect_to_page("users/view/".USER_ID);exit;redirect_to_action($action_name=null);exit;Convinient Function To Redirect to Page ActionExample Code: [Select]redirect_to_action('add');exit; Quote Selected
Re: Redirect Target for the controller Reply #4 – October 28, 2020, 07:31:19 PM This documentation tells how to use the function. I'm more looking for an example of where I would use that function. On the add page configuration there is an option for "Redirect to After Add" can I use that function there? How could I use this function to change where the redirect goes to after say for example adding a record? Quote Selected
Re: Redirect Target for the controller Reply #5 – October 29, 2020, 11:11:50 AM @rwebb the Redirect to After Add uses the above-metioned function. You can select the page you want to redirect to there, but if you want to redirect to a page based on your custom code check, you use the above-stated function, which what you initially asked for. In summary, you can use the code in Page Events. Quote Selected