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.
Redirect after update
-
- AppGini Super Hero
- Posts: 85
- Joined: 2014-06-14 03:08
- Location: India
- Contact:
Re: Redirect after update
Hi
Its very simple. You can just use
header("url:tablename_view.php");
Its very simple. You can just use
header("url:tablename_view.php");
-
- Posts: 10
- Joined: 2014-03-31 22:28
Re: Redirect after update
Do you mean add header("url:tablename_view.php"); in the hooks file for that table under the after update section?
Re: Redirect after update
after some effort I found the solution
1. go to hooks > tablename.php
2. go to function tablename_after_update and code like this
IMPORTANT : normally function will end with but must change it to
or else this code will not work !!!!
1. go to hooks > tablename.php
2. go to function tablename_after_update and code like this
Code: Select all
function tablename_after_update ($data, $memberInfo, &$args) {
header("Location : http://www.google.com ");
exit;
}
Code: Select all
return TRUE;
Code: Select all
exit;