Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Contact form not working
 
ZenMasta
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2010-03-12
 

I tried dropping a contact form block into a CMS page, but it’s not working.
I’m using this snippet

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

When you click the submit button the page appears to just reload, no confirmation the message was sent or anything.
I’m not getting any message either.

Now if I use the form at mydomain.com/contacts/index/ this will appear to work. Meaning it will display a confirmation message which is helpful for the user, but it doesn’t seem that I receive a message for this form either.

How do I fix this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
magestore
Mentor
 
Avatar
Total Posts:  1015
Joined:  2009-08-07
Viet Nam
 

Hi ZenMasta,

If you want add contact form block to homepage, after adding the following code

{{block type=core/template name=contactForm template=contacts/form.phtml}}
to CMS page content, you need to edit several things in magento core. Follow the procedure below
1. Go to file ..\app\code\core\Mage\Contacts\controllers\IndexController.php
in functin postAction(), change all line code
$this->_redirect('*/*/');
to
$this->_redirect('');
2. Go to file ..\app\design\frontend\base\default\template\contacts\form.phtml
change line code
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
to
<form action="<?php echo  Mage::getUrl('contacts/index/post'); ?>" id="contactForm" method="post">
Now refresh homepage and enjoy. Hope this helps.

Best Regards,
Magestore

 
Magento Community Magento Community
Magento Community
Magento Community
 
ZenMasta
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2010-03-12
 

I appreciate your reply. But would prefer not to edit core files even though I know I can copy that file to local instead and make changes there.

First I would like to fix why the default contact form is not working
mydomain.com/contacts/index

The form appears to work but I do not receive messages. I have a copy of my site on a different server and the form works on that server so why not on my live site?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ZenMasta
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2010-03-12
 

My issue is resolved

This was the code I had previously in my cms page.
{{block type=core/template name=contactForm template=contacts/form.phtml}}

I changed it to this:
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}

The form_action was missing from my original snippet and after using this new snippet my form works fine.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top