Redirect after save
3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 3, 2012 (RSS)
I've set-up related records to appear at the bottom of another record, in this case it's product availability records to appear at the bottom of a product record in the CMS.
I can add a separator using custom HTML for 'Create new record' which takes the user to the form to add a new product availability record but when they save this, they are taken back to the product availability section within the CMS.
Is it possible that after saving the record, I redirect them back to the product record that were looking at previously?
Thanks, Paul.
I can add a separator using custom HTML for 'Create new record' which takes the user to the form to add a new product availability record but when they save this, they are taken back to the product availability section within the CMS.
Is it possible that after saving the record, I redirect them back to the product record that were looking at previously?
Thanks, Paul.
Re: [pothompson] Redirect after save
By (Deleted User) - February 1, 2012
Hi Paul,
In order to set the previous url you need to add the variable 'return_url=' with the previous query html encoded as the value.
In your HTML separator, where you have the link to create a new record added, try the following:
The above is just an example, you'll need to tweak it to fit your code. The important bit is grabbing the current page view query ($_SERVER['QUERY_STRING']) and adding it to the end of the link so that it's passed in the URL.
Hope this helps,
Tom
In order to set the previous url you need to add the variable 'return_url=' with the previous query html encoded as the value.
In your HTML separator, where you have the link to create a new record added, try the following:
$current_query = htmlspecialchars($_SERVER['QUERY_STRING']);
$link = [current link]&returnUrl=$current_query;
The above is just an example, you'll need to tweak it to fit your code. The important bit is grabbing the current page view query ($_SERVER['QUERY_STRING']) and adding it to the end of the link so that it's passed in the URL.
Hope this helps,
Tom
Re: [Tom P] Redirect after save - Related Records
Thanks Tom, that's exactly what I wanted.
For anybody else that's interested, here's another great response of how to add a 'Create' button for a Related Records field which can then be used with Tom's suggestion:
http://www.interactivetools.com/iforum/P78970#78970
For anybody else that's interested, here's another great response of how to add a 'Create' button for a Related Records field which can then be used with Tom's suggestion:
http://www.interactivetools.com/iforum/P78970#78970