0

I have an issue with my contact form.

I have created a static block and I insert this code

{{block type='core/template' name='contactForm' action='/contact-us/index/post' template='contacts/form.phtml'}}

after that, I created a category and in the Display Settings tab I choose Static Block Only and choose the static block I created earlier. On the system configuration, I enabled the contact us, inputted my email address and choose what template to use.

Finally, the testing, the forms are completely fine however when I tried to submit the form it gives me 404 page. To check if the form is working, I navigate to magento default contacts page and test if I can send inquiry, however it returns

Unable to submit your request. Please, try again later

this is quite weird because my newsletter subscription is sending email but the contact us form is not.

I tried a lot of answers form the internet but no luck. Can you prove me some solutions?

  • Dont chage core files directly , or if you want then rewrite those class – Murtuza Zabuawala Sep 29 '16 at 7:41
0

You specify wrong action it should be like

{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}

use contacts instead of your current is contact-us

Also as in controller its checked server side validation to pass

name, comment, email and hideit(hide it as hidden variable) from your front end form

i am sure it will work for you.

let me know if i could help you more in this.

  • I tried it earlier however it didn't work and redirects to the default magento contact form page – rodge Sep 29 '16 at 4:29
  • After post it will be redirect to contacts page either you have to create your own action or override contact us module and make extra action in same controller and set redirect as you want – liyakat Sep 29 '16 at 4:34
  • you can look in to this class for detail code in core file how it is currently working Mage_Contacts_IndexController – liyakat Sep 29 '16 at 4:35
  • I have check the Mage Class and I found out that on my form.phtml, I got a typo on email. The issue now is that after submit it redirects to the default magento contact form. – rodge Sep 29 '16 at 6:17
  • you should have to create your own action – liyakat Sep 29 '16 at 6:33
0

Change your code as below:

{{block type='core/template' name='contactForm' action='/contacts/index/post' template='contacts/form.phtml'}}

Override Mage_Contacts_IndexController in postAction change code

$this->_redirect("/*/*");

to:

$this->_redirectReferer()

It will redirect as per you looking

  • $this_redirectReferer() didn't work for me. – rodge Sep 29 '16 at 6:17
  • 1
    @rodge sorry typo mistake please check updated answer – Prashant Valanda Sep 30 '16 at 16:42
0

Some time It create problems So Go to below file and change Form Actionaccordingly

app/design/frontend/YourPackage/YourTheme/template/contacts/form.phtml

<form action="<?php echo Mage::getBaseUrl(); ?>contacts/index/post" id="contactForm" method="post" class="scaffold-form">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.