RedirectAfterUpdate

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
drascom
Posts: 16
Joined: 2013-04-20 16:54

RedirectAfterUpdate

Post by drascom » 2013-05-05 23:03

i use $x->RedirectAfterInsert = "some page.php"; to change redirect but is there RedirectAfterUpdate or RedirectAfterDelete :idea:

User avatar
a.gneady
Site Admin
Posts: 992
Joined: 2012-09-27 14:46
Contact:

Re: RedirectAfterUpdate

Post by a.gneady » 2013-05-11 20:21

No, though I plan to add these in future releases.
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

:arrow: Summary Reports plugin enables you to build powerful reports and charts inside your AppGini application through a few simple steps. See the big picture and discover trends in your data that empower you to take the right decisions confidently.

:arrow: Search Page Maker enables you to build user-friendly yet powerful search pages for your AppGini application by simply dragging and dropping the fields you want to include in search.

drascom
Posts: 16
Joined: 2013-04-20 16:54

Re: RedirectAfterUpdate

Post by drascom » 2014-12-18 09:26

is there any improvements on this feature ?

rmloehmann
Posts: 10
Joined: 2014-03-31 22:28

Re: RedirectAfterUpdate

Post by rmloehmann » 2015-02-24 18:18

This does cause issues. The redirect to addnew after an update takes it to an update page where you save changes. If the user doesn't notice and enters new records, the records disappear. This can cause integrity issues for the program because people make these kind of mistakes all the time. Any plan on updating this soon to allow redirectafterupdate or redirectafterdelete?

udayvatturi
AppGini Super Hero
AppGini Super Hero
Posts: 85
Joined: 2014-06-14 03:08
Location: India
Contact:

Re: RedirectAfterUpdate

Post by udayvatturi » 2015-02-27 05:52

Hi,
Are you sure that redirecting after update will cause some issues related to permissions.
The issue might be some thing like, not updating user records table after update. But I think it may not be an issue, as record will be already inserted into user records table when inserted, redirecting after update may not cause a issue i think.

This may be bit confusing.

I think only Ahmad can tell what will be the issue if we put redirect statement after update..
Thanks
Uday V
uday@spgon.com
http://www.spgon.com

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 207
Joined: 2013-03-21 04:37

Re: Redirect After Update

Post by peebee » 2016-09-12 23:48

Has anybody managed to work out a simple/safe method to redirect after update, preferably with a hook of course?

Looking to implement a redirect after update myself and I'm not too proud to borrow somebody else's work if already achieved. Thanks. :)

DevGiu
AppGini Super Hero
AppGini Super Hero
Posts: 151
Joined: 2016-05-27 09:08

Re: RedirectAfterUpdate

Post by DevGiu » 2016-09-13 12:04

Code: Select all

header("Location: index.php");
/Giuseppe
Professional Outsourcing Services

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 207
Joined: 2013-03-21 04:37

Re: RedirectAfterUpdate

Post by peebee » 2016-09-13 23:30

That was the first thing I tried but can't get it to work? Not sure why?

This snippet in datalist.php seems to take over and end result is always the same: update and end up on same record in detail view

Code: Select all

elseif($update_x != ''){
			$updated = call_user_func($this->TableName.'_update', $SelectedID);

			$update_status = 'record-updated-ok=' . rand();
			if($updated === false) $update_status = 'record-updated-error=' . rand();
Have you succeeded in redirect after update? How exactly?

bdurfee
Posts: 20
Joined: 2013-02-07 17:44

Re: RedirectAfterUpdate

Post by bdurfee » 2017-08-25 18:41

I figured out a workaround. I needed the user to access the detail view to update their record and after saving be redirected to another page. The URL to edit the record is tablename_view.php?SelectedID=userid (where userid is the record ID). Therefore, add this to header.php on line 1.

Code: Select all

<?php
	$mi = getMemberInfo();
	if($_GET['SelectedID']){
		// show the page

	}elseif($mi['groupID'] == '5'){
		$return_url = 'mypage.php';
		header("Location: $return_url");
		
	}
?>
After submitting, SelectedID no longer exists in the URL so it redirects back to the page where I want them.

This allows you to set many different options regarding where you want users redirected and the conditions to do so.

User avatar
jmcgov
Posts: 18
Joined: 2018-12-19 01:31

Re: RedirectAfterUpdate

Post by jmcgov » 2019-01-09 22:43

This seems to work
- but you forfeit the record update audit (return = true does not get executed)
- you dont have to put in the condition, it is the exit that forces the redirect to be heeded (I think)

Code: Select all

	function cmembers_after_update($data, $memberInfo, &$args){
		if($_POST['update_x'] == '1'){
			header("Location: index.php"); 
			exit();
		}
		return TRUE;
	}

User avatar
jmcgov
Posts: 18
Joined: 2018-12-19 01:31

Re: RedirectAfterUpdate

Post by jmcgov » 2019-01-10 09:51

Mmh, you probably could do a manual record update audit edit

Post Reply