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

Action in Contact Form
 
keithabt
Jr. Member
 
Total Posts:  13
Joined:  2008-09-08
 

Can anyone tell me how the action attribute gets set in form.phtml?
Mine shows up blank

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

Can you be more specific than that file name (and what you mean by “action attribute")? File location (path/to/file/form.phtml)?

 
Magento Community Magento Community
Magento Community
Magento Community
 
keithabt
Jr. Member
 
Total Posts:  13
Joined:  2008-09-08
 

Sorry,

I have a Contact page which I created through the Admin.
In Custom Design, I added the following:
<block type="core/template" name="contactForm" template="contacts/form.phtml"/> which pulls in the contact form.
However, when I view the source there is nothing in the ‘action’ attribute as follows:
<form method="post" id="contactForm" action="">

Im not sure how or where to define action="”

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

The form action is set in Mage_Contacts_IndexController, function indexAction. This is loaded on the contacts page and not on your CMS page, which is why no form action is defined in your situation.

I guess you need to post to the postAction of the Contacts module, so a solution would be to simply hardcode the action in form.phtml:

Replace <?php echo $this->getFormAction(); ?> with <?php echo Mage::getUrl(); ?>contacts/index/post/

 
Magento Community Magento Community
Magento Community
Magento Community
 
keithabt
Jr. Member
 
Total Posts:  13
Joined:  2008-09-08
 

Thanks Anders

That worked.. however im getting a “unable to send request at this time” error.

As you said the contact form is usually located on the contacts page so I tried to send from that page as well but get the same error.

I have Contact us enabled in the admin and the emails set up.
Is there something else that needs to be enabled?

Anyone having this issue with the contact form?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Invoicera
Jr. Member
 
Total Posts:  16
Joined:  2009-01-13
 

Hi,

I got the same “unable to send request at this time” error but i found that i was getting error on my local machine and when i run this code on my server it was running fine and got the email.

Might be it can help you

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