Search

I'm having trouble getting an event to redirect to the newly created entry on submit. Here is the code I have so far with the help of @rainerborene via this discussion.

<form method="post" action="" enctype="multipart/form-data">
  <fieldset>
    <input name="redirect" type="hidden" value="{$root}/statements/{//new-entry/post-fields/statement}"/>
    <label class="required">Statement <input name="fields[statement]" type="text" /></label>
    <input name="action[save-statement]" type="submit" value="Submit" />
  </fieldset>
</form>

The event is saving correctly and I am able to go to the statements/id url manually. I just want to go directly to that URL on submission of the form. I am using the system id as the filter so my urls get produced as http://domain.com/statements/1234/.

Any ideas? Thanks.

I think your problem is that //new-entry/post-fields/statement will be populated after you submitted the form you’re setting up in your example.

Thanks @Nils. Is there another method I should be calling? Or do you have any idea on performing this action after it is populated? Thanks.

@chadspen, is the entry creation page a different url from the newly created post page? if not, it may be possible to just give it a "" (blank) @value. I know on the contact form submission, the form action is left blank so after submission the user is brought back to the same page. not sure if you can apply this to your situation.

Yes, the entry creation page is a different url from the created post page. The entry is created from the home page and generates a post that is located at /statements/(system-id)/

is there anyway to see what the next id created will be? or base it off the previous id, possibly?

Hmm, I didn't think of that. Basing it off the previous ID might work. Any other ideas please let me know. Thanks for the help.

my only concern with the approach i mentioned is that i’m not 100% certain if those will be sequential. i think if you create any content entry, symphony automatically increments the ID value you are probably going to try and use. so if a user creates an entry with ID = 100, then you create a post for a different page, i think that post will be ID = 101, then another user creates a post, the ID will then be 102. so i think if you did do it this way, you’d need to have a data source (DS) that contained the latest ID from every content section somehow.

anyone, feel free to correct me if i’m wrong.

Try the Dynamic Event Redirect extension (I asked about the ID at the end of the thread).

That said, I think this functionality should really be in the core since it’s quite integral to the way events function. I know I’ve required it several times. I’ll have a think about how this could be implemented cleanly and suggest it to Allen/Alistair.

@nickdunn Thank you so much, the extension worked! I can't believe I didn't run across that. Also thanks to @Makenosound for the extension.

@nickdunn I completely agree.

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