Search

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:

<input id="submit" type="submit" name="action[depf]" value="Set filter" />
 <input name="redirect" type="hidden" value="{$root}/deposits/" />

Redirection is not working.
I know that I could do redirection from an event, by just adding this to the _trigger function:

protected function __trigger(){
     header ('Location: /deposits'); 
              return $result;
             }

But I wonder is it possible to add something to the event which would make

<input name="redirect" type="hidden" value="{$root}/deposits/" />

work?

I feel it might be just a simple function call to make Symphony think that the event was successful.

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.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details