We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Change how "message templates" work

How Do I?

zm1210's avatar
zm1210
1 posts
2 years ago
zm1210's avatar zm1210

Hello,

I was testing ExpressionEngine long time ago and there’s one thing I do not like. I believe it’s called “Message templates”.

Is it possible to create ajax messages?

For example: When I fill out contact form and click submit, a success message above contact form would appear?

       
Russ K.'s avatar
Russ K.
174 posts
2 years ago
Russ K.'s avatar Russ K.

Not sure what all you want to do exactly, but The example you give does not require AJAX really…

Below is an example from one of mine which DOES post the message and reload the page (although if it can be done this way then it can certainly be done via AJAX - maybe someone else has an example of that)

In the example below:

  • “redirect=”none” bypasses the System default message (which you posted an image of)
  • return=”contact/thank-you” - this just returns the user to the current URL (or you could make it an URL) and the “Thank You” in the second segment gives you something to control the output of the page.

Contact Form:

{if segment_2 == 'thank-you'}
     <div class="alert alert-success" role="alert">
          Thank you, your Email has been sent.  Someone will get back to you soon.
     </div>
{/if}

{exp:email:contact_form redirect="return" return="contact/thank-you" replyto="yes" recipients="" charset="utf-8"}
    YOUR EMAIL FOR CONTENT
{/exp:email:contact_form}

In the case of the example above, it simply refreshes the page and places the Success/Thank You message above the form, but you could replace the form entirely with your thank you message if you wanted to.

Hope that helps:

Russ

PS… More info in the Docs

  • https://docs.expressionengine.com/latest/add-ons/email.html
  • https://u.expressionengine.com/course/getting-started-with-expressionengine-video-course/getting-started-with-expressionengine-contact-form
       
MarioF's avatar
MarioF
1 posts
2 years ago
MarioF's avatar MarioF

Hello,

Can somebody clarify how the value inserted in the “return” field work? Where does it come from?

I followed the example above, putting return=”contact/thank-you” in a contact form (EE7), but I get an error message: “Error The page you requested was not found.”

Instead of refreshing the page adding the new segment (thank-you) to the url, the system looks for the “thank-you” page.

I tested the same with EE6, installed with the default theme.

In that case it works. The return value is set to “contact/thanks”. If I change it to “…/thank-you” or whatever it returns the page error as indicated before for EE7.

What am I missing?

Thanks Mario

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.