How to make redirect work when using custom event
This is an open discussion with 3 replies, filed under General.
Search
As far as I remember, redirection will only work if there is an event attached to the page. The event will run it's course (i.e. adding data to an entry) then once completed successfully, will redirect if specified.
So, adding the following (taken from line 443 of class.event.section.php
)
if(isset($_REQUEST['redirect'])) redirect($_REQUEST['redirect']);
to an otherwise empty event will cause the redirect to work.
Just create a normal event, strip out all of the logic from the __trigger()
function and add that line to make it work.
I forgot to add, any event result will not be passed along to the new location.
Thank you!
if(isset($_REQUEST['redirect'])) redirect($_REQUEST['redirect']);
That's exactly what I was asking for. Works.
Create an account or sign in to comment.
Hi! I have a page with a simple form and a custom event. I'd like the visitor be redirected upon pressing the button in the form.
So, I put this at the end of the form:
Redirection is not working.
I know that I could do redirection from an event, by just adding this to the _trigger function:
But I wonder is it possible to add something to the event which would make
work?
I feel it might be just a simple function call to make Symphony think that the event was successful.