Magento – Issue with creating additional contact forms – recaptcha

cmscontact-usformsmagento-1.6PHP

I'm trying to create an additional contact form and am running into an issue – initially I modified the default contacts form but ran into issues so tried just using the default contact form on a CMS page, using the following code:

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

but whenever I try to submit the form it produces the following error

Fatal error: Call to a member function setFormAction() on a non-object in /home/urider/web/app/code/community/Fontis/Recaptcha/controllers/ContactsController.php on line 32

line 31,32 is as follows:

$this->loadLayout();
$this->getLayout()->getBlock('contactForm')->setFormAction( Mage::getUrl('*/*/post') );

From what I've seen online it may be something to do with the layout not being loaded but I'm really not sure, any thoughts?

Best Answer

Just change form action in full format:

remove this code: $this->getLayout()->getBlock('contactForm')->setFormAction( Mage::getUrl('*/*/post') )

Change form action: `action="<?php echo Mage::getUrl('contacts/index/post') ?> "`
Related Topic