Page 1 of 1

Redirect after update

Posted: 2015-02-24 18:59
by rmloehmann
I need to redirect to a different page after a record is updated. Does anyone know if this can be done through a hook, and if so how?

The issue I am having is that the table is set to redirect to tablename.php?addNew_x=1. This works fine when you add a new record, it inserts the record and then goes to a blank add new to continue adding records. The problem occurs when someone updates a record. When you are on the add new page you have the option of add new, when you update a record you have the option of save changes. One does an insert,the other an update obviously. The problem is that when someone opens an existing record and updates it, they click on save changes and it updates, then takes them to a blank screen except it is the blank update screen with the option of save changes, not save new. Users are careless and don't pay attention, so they open an existing record, make and save the changes,then continue to add new records in this screen, thinking they are adding records. They receive a record updated successfully message, even though it isn't actually updating or adding anything and the record disappears. Then they are missing records. I know this is a user error situation, but I need to be able to redirect to the table view after updating a record to stop this from happening. I don't want to change the redirect to tablename.php?addNew_x=1 after adding new because this creates a whole lot of unnecessary clicks when you have to constantly add records. Thinking possibly an after update hook? Help, really in need of a solution before I lose my client. I have spent 100s of hours already just figuring out what was going on, of my own time.

Re: Redirect after update

Posted: 2015-02-25 03:48
by udayvatturi
Hi
Its very simple. You can just use

header("url:tablename_view.php");

Re: Redirect after update

Posted: 2015-02-26 23:28
by rmloehmann
Do you mean add header("url:tablename_view.php"); in the hooks file for that table under the after update section?