Question

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

Was it helpful?

Solution

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">
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top