I am trying to create a create a page in block but I'm trying to add a custom contact form. I can view it in frontend but it wouldn't work its not doing anything when I click submit.

is there anyone who could help me out or any suggestions

Is it good to create a new module for custom form?

How I'm calling the .phtml in CMS block

{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="my_module::form.phtml"}}

but not sure why action="<?= $block->escapeUrl($block->getFormAction()) ?> isn't working in .phtml

enter image description here

enter image description here

  • Try this {{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="My_Module::form.phtml"}}. You have added ( and ) at the start and end of code. Commented Jun 14, 2019 at 11:43
  • @SukumarGorai what you mean by this ("You have added ( and ) at the start and end of code.") Commented Jun 14, 2019 at 11:50
  • At the start of your code there is bracket "(" and end ")". Remove those. Commented Jun 14, 2019 at 11:54
  • </div> {{block class="Magento\Contact\Block\ContactForm" name="newContactForm" template="Limitless_HelpCenterContactForm::form.phtml"}}</div> </div> this si what i have i dont have the brackets() Commented Jun 14, 2019 at 11:56
  • the person who edited this add them brackets in Commented Jun 14, 2019 at 11:56

2 Answers 2


i have tried creating controller. but no result this is the form i have created even if i click submit i am not even getting no error message. @ Khushbu enter image description here

  1. You should create controller as explained in Create controller
  2. Give link of that controller in your form action.
  3. In controller execute() method you can get posted data as below:
  1. Do required processing with received data.
  • I have tried this now but no result same as before Commented Jun 14, 2019 at 11:52
  • Do you get redirected to controller page or not?
    – Khushbu
    Commented Jun 14, 2019 at 12:38
  • i dont have no redirect, the form isn't working l no error message when i press submit Commented Jun 14, 2019 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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