3

in magento 1.x for add contact form in CMS page i use next code

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

How I can add contact form in CMS page in magento 2

15

Call your contact form block with template file in the cms pages.

Try below code :

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}
  • Any ideas how to stop it from redirecting back to contact/index/index on form submission. Would be nice to just submit the form, and remain on the page with the contact block in it? – Graham Wharton May 19 '19 at 22:17
  • @GrahamWharton - Then you need do some workaround with Ajax based form submission. – Manthan Dave May 20 '19 at 5:59
5
{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}

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.