Magento Forum

Confirmation page / Thank you page for Contact Us form {SOLVED}
 
abovethefold
Jr. Member
 
Total Posts:  13
Joined:  2008-03-16
Boston, MA
 

Hi there,

How do I redirect users that fill out the contact us form on our magento site to a thank you page (or any CMS page for that matter)? Right now, if you submit the form, the page redirects to itself without any visual clue that the user’s information has been submitted.

** UPDATE 1 **: Saw this post (http://www.magentocommerce.com/boards/viewthread/22807/) and tried the suggested code changes, but they did not work.

** UPDATE 2 **:  Disregard update 1...I had to refresh the cache. This code below (taken from the aforementioned thread) allowed me to redirect to a custom CMS page called thankyou.

<!– CONTACT FORM –>
{{block type="core/template" name="contactForm" template="contacts/form.phtml"}}
<script type="text/javascript\">
elem = $("contactForm");
elem.writeAttribute(’action’, ‘thankyou’);
</script>
<!– END OF CONTACT FORM –>

 
Magento Community Magento Community
Magento Community
Magento Community
 
crea-viv
Jr. Member
 
Total Posts:  8
Joined:  2010-06-22
 

hi!

did you put your contact-form in a cms site?

where do i have to put this code above, if I use the standard contact-form?
do you have any idea?

thanks.
vivianne

 
Magento Community Magento Community
Magento Community
Magento Community
 
mancourt
Member
 
Avatar
Total Posts:  34
Joined:  2010-08-03
 

Weird, whenever I do this the WYSIWYG (even in html mode) editor adds the <![CDATA[ code

This seems to break the forward to the thank you page… Any ideas?

{{block type="core/template" template="contacts/form.phtml"}}
<script type="text/javascript">// <![CDATA[
elem = $("contactForm"); 
elem.writeAttribute(’action’‘thankyou'’);
// ]]></script>
 
Magento Community Magento Community
Magento Community
Magento Community
 
chae_riley
Jr. Member
 
Total Posts:  13
Joined:  2010-03-16
 

I had the same formatting error with inserting the javascript directly into the CMS page.

The easiest & most simplest thing to do I found was…

1. Create your thank you page in the CMS, take note of it’s URL Key

2. Open up the following file in a text editor - /app/design/frontend/base/default/template/contacts/form.phtml
scroll to the very bottom & add the following bit of code:

<script type="text/javascript\">
elem = $("contactForm");
elem.writeAttribute(’action’, ‘/thankyou’);
</script>

Save, clear browser cache open contact form on web site & test. Obviously you’d replace my thankyou with the URL Key created earlier on.

All other solutions on how to redirect the contact form just didn’t work for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
vickydada
Jr. Member
 
Total Posts:  1
Joined:  2010-06-13
 

Follow the following steps to show confirmation page.

1) go to CMS->Pages and add new page (Thank You) with URL Key “thankyou”
2) Now open file app/code/core/Mage/Contacts/controllers/IndexController.php
3) find
Mage::getSingleton(’customer/session’)->addSuccess(Mage::helper(’contacts’)->__(’Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.’));
4) after that line replace $this->_redirect(’*/*/’); with $this->_redirect(’thankyou’);

 
Magento Community Magento Community
Magento Community
Magento Community
 
noobcode
Jr. Member
 
Total Posts:  3
Joined:  2011-04-12
 
vickydada - 25 February 2011 10:09 PM

Follow the following steps to show confirmation page.

1) go to CMS->Pages and add new page (Thank You) with URL Key “thankyou”
2) Now open file app/code/core/Mage/Contacts/controllers/IndexController.php
3) find
Mage::getSingleton(’customer/session’)->addSuccess(Mage::helper(’contacts’)->__(’Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.’));
4) after that line replace $this->_redirect(’*/*/’); with $this->_redirect(’thankyou’);

I have my contact us code on CMS page. And i want to redirect the user to the same page along with a message that their form was submitted successfully. So i put

$this->_redirect('contact-us');
the page gets redirected but the message does not show up.
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top