I am embedding the contacts form onto a CMS page with this bit of layout XML:
<reference name="content">
<block type="core/template" name="cmsContactForm" form_action="/contacts/index/post" template="contacts/form.phtml"></block>
</reference>
However, when I am on that CMS page this bit of code on the contacts form page:
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
The getFormAction()
method returns an empty string, resulting in the contact form failing as it just refreshes the page instead of submitting the information in the contact form.
Can anyone tell me how to get a proper form action from getFormAction()
?
Is there a relevant helper that I can employ on a CMS page?
Best Answer
In Magento post action for contact page is set in controller class
In action
indexAction()
If you declare the post action in block xml
You can get it in block file which you are using as
core/template
and you can not get it in phtml directly.You can use directly like