23
votes
Magento2 contact form in CMS page
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"}}
14
votes
Magento 2 - State/Province dropdown and Country Dropdown in Contact form
Following method will add Country and Region dropdown to contact us form,
[namespace]/[modulename]/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
9
votes
Accepted
How to Validate the Google reCaptcha
You should try this code: I have been using this on my site.
<script>
window.onload = function() {
var recaptcha = document.forms["contactForm"]["g-recaptcha-response"];
recaptcha.required =...
8
votes
Contact form after submission not redirecting to cms page Magento 2
Contact Post Controller needs to be overridden here, because by default it redirects to contact/index
$this->_redirect('contact/index'); needs to be changed to $this->_redirect('cms-page-url-...
7
votes
How to Validate the Google reCaptcha
The accepted JavaScript solution above is definitely NOT the way to go in my opinion. Any bot that's not using JS (which is most of them) will simply bypass your validation and you'll get all that ...
7
votes
How to Validate the Google reCaptcha
This script use for validation google reCaptcha like a default validation of magento. please use it.
<form name="freeeventForm" id="freeeventForm">
<div id="RecaptchaField"></div&...
7
votes
Add Captcha to magento 2 contact form on cms page
There is no need to call <p>{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}</p> in the content tab.
If you don't have any ...
6
votes
How to Validate the Google reCaptcha
I used recaptcha in contact form..
<form action="<?php echo Mage::getUrl('mcrecaptcha/index/save'); ?>" id="contactForm" method="post" onSubmit="return checkcaptcha() ;">
<ul class=...
5
votes
Magento2 contact form in CMS page
{{block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml"}}
5
votes
Magento 2 : Show captcha at contact us form
You can make a custom form template (based on the original) then you can load reCaptcha block programmatically whith this :
<?php
echo $block->getLayout()
->createBlock('MSP\...
4
votes
Contact us email not sending
Try this, Hope It's helpful for you.
your website is just on localhost, which does not support sending email (some tools allow but not many).
The following solution will help you much with ...
4
votes
Accepted
Magento 2 Plugin for Contact Form Post Controller
At this,case you have to use around method (aroundExecute()).
First, create di.xml at app/code/{VendorName}/{Modulename}/etc/frontend/ for define plugin class.
<?xml version="1.0"?>
<config ...
3
votes
Accepted
Submit a form in Magento 2 custom module?
create a controller Save.php and copy paste in your module.
<?php
namespace [Namespace]\[ModuleName]\Controller\Index;
class Save extends \Magento\Framework\App\Action\Action
{
/**
* @...
3
votes
Magento2: How to validate form and display error message below input field
Form ID: #custom-register-form
Before Submit the form Check the validation
To Check All Fields & Display Error:
$('#custom-register-form').on('submit', function (event) {
var dataForm = jQuery('...
3
votes
Magento2: How to validate form and display error message below input field
Form Validation can be applied in three ways:
1)
<script type="text/x-magento-init">
{
"#custom-form": {
"validation": {}
}
}
</script>
2)
<form data-mage-init='{"...
3
votes
How to Validate the Google reCaptcha
To validate captcha, create a save controller for saving your form values and also the validation.
namespace Mike\SampleModule\Controller;
class Save extends \Magento\Framework\App\Action\Action
{
/*...
3
votes
Accepted
Add new custom field in magento 2 contact form
Open your form.phtml file.
/magento_root/app/design/frontend/VENDER/YOUR_THEME/Magento_Contact/templates/form.phtml
Then add mycustomfield field to this contact form:
<div class="field ...
3
votes
Accepted
how to store contact us form details in database programmatically magento 2?
Magento does not have this functionality. So you have created a module which has
Database table
Model class
ResoureModel Class
Collection class
Then for saving the data, you have to rewrite the ...
3
votes
how to store contact us form details in database programmatically magento 2?
Us this free extension to store data in database.
By using observer can get all data
This module will add a table to your Magento 2 database. As with any third party modules that do this, it is ...
3
votes
Accepted
Add custom field in contact form
For achieved this functinality
We need to create source model.
Dont used it inline in form
First create source model
<?php
namespace Custom\Module\Model\Config\Source;
use Magento\...
3
votes
How to submit contact us data to Magento 2 contact us form action using graphqL?
Since we don't have default contact us mutation in default magento graphql,
I did this task with a custom module.
For this we want to create the custom contact us Mutation.
type Mutation {
...
3
votes
Accepted
Implementation of sending selected items along with feedback form
Download module from here and install it.
I have created example module i.e Warranty and there is a form with name, email and elements
Elements contain 5 options : Element A, Element B, Element C, ...
3
votes
Unable to send emails. Could not acquire lock for cron job: sales_send_order_invoice_emails
I guess Magento cron job is stuck in "running" status. Need to kill the stuck cron job then it will continue as scheduled.
Log in to your account using SSH.
Run the following command to ...
2
votes
Accepted
Input value must contain number higher than 5
You can use custom validation class 'validate-value-greater-than-5' and add following script in form javascript.
Validation.add('validate-value-greater-than-5', 'Please enter a value greater than 5.',...
2
votes
Input value must contain number higher than 5
You have to just use type=number in input.
<input type="number" name="quantity" min="6">
Now user have input 6 or higher than 6 to submit form otherwise display error with no form submit.
2
votes
Accepted
Magento 1.9 Contact form
You have to create another custom form, like this Inchoo tuto, then you can include the form in your cms page according this tuto like this:
{{block type="core/template" name="form.custom" ...
2
votes
Magento 1.9 Custom Module Form $mail = new Zend_Mail(); include more $params
you can add like html
$html = 'Your Name'.$params['name'];
$html .= 'Your Email'.$params['email'];
$html .= 'Your Business Name'.$params['business_name'];
$html .= 'Your Business Address'.$...
2
votes
Accepted
Magento 1.9 Custom Module Form $mail = new Zend_Mail(); include more $params
Try this:
<!-- I haven't tested it but tell me about a result-->
public function sendemailAction() {
$params = $this->getRequest()->getParams();
$name = $this->getRequest()->...
2
votes
Contact form email template - Array
Magento doesn't allow to use array in email variable.So change checkbox html as below.
<input type="checkbox" name="contact_method_tel" value="Telephone"> Telephone<br>
<input type="...
2
votes
Accepted
How to change a field or add new field in contact us form
Open form.phtml file located at app/design/frontend/default/YOUR_THEME/template/contacts folder.
Then find the following lines of code:
**
<li>
<label for="telephone"><?php echo ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
contact-form × 168magento2 × 71
contact-us × 51
magento-1.9 × 46
email × 21
forms × 19
magento2.3 × 10
form-validation × 9
captcha × 9
transactional-mail × 8
magento-2.1 × 5
php × 5
magento2.2 × 5
controllers × 5
email-templates × 5
layout × 4
javascript × 4
blocks × 4
cms-block × 4
magento-1.8 × 3
module × 3
magento2.4 × 3
redirect × 3
cms × 3
plugin × 3