ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Email Contact Form - Need help configuring dynamic "return" page

March 05, 2012 1:17pm

Subscribe [2]
  • #1 / Mar 05, 2012 1:17pm

    Envision

    18 posts

    Hello everyone,

    We have a dynamic channel of entries (pages) within a template. Each entry (page) has a form at the bottom. The form sits inside of the template. Once the user fills out the form, I want them to be brought to a success/return page where new data (from other fields not shown on form page) from the same channel entry/page will be displayed.

    Can I put a “channel:entries” call inside of the “email:contact_form”? It seems that I cannot, even if I wrap it in a channel entry tag.

    {exp:email:contact_form user_recipients="false" recipients="[email protected]" return="{site-path}white-papers-download/{url_title}" charset="utf-8"}

    Does anybody know how to configure a return page dynamically with the default EE form? Or is there an Add-On that does this?

    Thanks!

  • #2 / Mar 05, 2012 9:38pm

    John St-Amand

    865 posts

    You could just use segment variables. So if your form is at domain.com/white-papers/URL-title you could easily make the return {path='{segment_1}/{segment_2}’} and if you needed to throw in a “thanks” segment, you could do that as well.

  • #3 / Mar 07, 2012 12:52pm

    Envision

    18 posts

    Hi John,

    I’ve tried a few things, but I still can’t quite figure out what you’re suggesting.

    I have a template called “white-papers”. So, at http://www.domain.com/white-papers there is a dynamic list (via channel entries) of links to individual white paper pages (at segment 2).

    At segment 2 (http://www.domain.com/white-papers/whitepaper-title for example) there is a teaser about the whitepaper and an EE contact form.

    Once the user fills out the contact form, I want them to be brought to http://www.domain.com/white-papers/whitepaper-title/download. However, all of this info is dynamic. According to the Email Contact form guide, the return path must be hard coded: return=“http://example.com/index.php”

    So, what return path do I put in my contact form tag? I need it be “dynamic”. Here is my current opening tag:

    {exp:email:contact_form user_recipients="no" recipients="[email protected]" return="{path=/white-papers/{segment_2}/{segment_3}}" charset="utf-8"}

     

  • #4 / Mar 07, 2012 2:43pm

    Envision

    18 posts

    {exp:email:contact_return="{path=/white-papers/download/{segment_2}}"  form recipients="[email protected]" charset="utf-8"}

    I figured it out!

    I didn’t understand that {segment_2} was pulling from the current URL as a variable.

    I also didn’t know that you could put “path=...” in the return field.

    Thanks!

  • #5 / Mar 07, 2012 6:53pm

    John St-Amand

    865 posts

    Actually, i would have expected the return to be {path='white-papers/{segment_2}/download’} but yeah, the reverse could work too if there is an actual download template and you’re simply looking to dynamically set up what it then has access to by virtue of one of the segments being the url title of the entry in question.  Glad you got it figured out.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases