2

I have a contact form on my Contact Us page as follows;

{{block type='core/template' name='contactForm' template='contacts/form.phtml'}}

The form displays correctly but when I click 'Submit' the page simply refreshes, clears the form, and no confirmation/failed message displays. I also don't receive any email.

In my System > Configuration > Contacts I have Enable Contact Us set to Enabled and a correct email address in Send Emails To.

For the record, I'm using Magento 1.9.1

10

It's happening because the action attribute of form gets set by the controller file of the module, which is not being called as you are placing it on a custom page. You'll need to add that action to the form for proper submit behavior of contact form. For a quick fix, if you have your form.phtml file in theme folder, you can change the form action in it as :

<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">

to

<form action="<?php echo Mage::getUrl('contacts/index/post'); ?>" id="contactForm" method="post">
  • Hello @Prateek Thank you for your response - it worked :) The form now submits successfully and I receive an email with the contents. One last thing.. I notice the form redirects to 'contacts/index' upon submission. Is it possible to redirect to a custom page, such as a 'thank you' page or something? Is this possible? – Matt Aug 5 '15 at 21:34
  • Yes, it's completely possible. You'll have to rewrite the controller. You can look around for it, it's pretty easy. – Prateek Aug 6 '15 at 8:41
  • This replacement work for the Pagayo pt004 electronic theme too. – Nolwennig Feb 15 '16 at 15:48
  • hi, i am getting 404 page error on this url : /contacts/index/post. can you help? – Gaurav Dec 6 '18 at 13:01
  • @Gaurav, it's very much likely due to some incorrect rewrite of core module. Try starting with the basic troubleshooting of Magento application. – Prateek Jan 6 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.