-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact form submission not saved due to validation error #249
Comments
Having this issue also. Removing validation on lines 47 - 50 of mailer.php also resolving issue for me. Carft version: 4.4.13 |
@LouisCuvelier did you double check that you send a value for
These fields are a requirement for the plugin to work properly (I think this could be better emphasized in the README @pi– and I think submitting a form without an E-Mail field should also be possible). I happened to stumble across the same behaviour today – debugging revealed there was an actual problem here... Running on 3.0.1 with Craft 4.4.12 with PHP 8.0.23. |
@fvwanja Yes I did. |
Just installed Contact Form on a fresh Craft 4.4.14 installation and used the OP’s template, and I’m not able to reproduce this. The form successfully submits with no validation errors, and required field validation seems to work as expected, and the example form error handling logic seems to pick it up fine. If someone can provide more details/steps in case we’re missing something, let us know, and we'll look into it further. As it stands, I’m not 100% sure what an actionable item is we could do here. |
Hey @angrybrad 👋 Thanks for dropping in You could improve the documentation in https://github.com/craftcms/contact-form/blob/main/README.md as well as the validation on what is required for the forms to actually work – and most of all why the requirements exist 👍 much appreciated! For example tell us about any required fields like @LouisCuvelier can you try different versions like 3.0.0-beta.2 from #249 (comment) and see if that fixes your issue? |
@fvwanja Nop, downgrading doesn't solve the issue. Also, I've updated to Craft 4.4.14. It changed nothing. @angrybrad here's my full {
"require": {
"craftcms/anchors": "3.2.0",
"craftcms/cms": "4.4.14",
"craftcms/contact-form": "3.0.1",
"craftcms/redactor": "3.0.4",
"craftsnippets/table-of-contents": "2.0.0",
"doublesecretagency/craft-cpcss": "2.6.0",
"ether/simplemap": "4.0.3",
"jalendport/craft-readtime": "2.0.0-beta.1",
"matt-west/craft-recaptcha": "2.0.2",
"mmikkel/retcon": "2.6.1",
"nystudio107/craft-cookies": "4.0.0",
"nystudio107/craft-disqus": "4.0.0",
"nystudio107/craft-eagerbeaver": "4.0.2",
"nystudio107/craft-emptycoalesce": "4.0.0",
"nystudio107/craft-minify": "4.0.0-beta.2",
"nystudio107/craft-retour": "4.1.12",
"nystudio107/craft-seomatic": "4.0.28",
"nystudio107/craft-templatecomments": "4.0.0",
"nystudio107/craft-twigpack": "4.0.0-beta.4",
"nystudio107/craft-typogrify": "4.0.1",
"verbb/consume": "1.0.3",
"verbb/field-manager": "3.0.6",
"verbb/image-resizer": "3.0.6",
"verbb/super-table": "3.0.9",
"vlucas/phpdotenv": "^5.4.0",
"workingconcept/craft-cloudflare": "2.0.0",
"wrav/oembed": "2.3.0"
},
"autoload": {
"psr-4": {
"modules\\": "modules/"
}
},
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"allow-plugins": {
"yiisoft/yii2-composer": true,
"craftcms/plugin-installer": true
},
"platform": {
"php": "8.0.2"
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-update-cmd": [
"@php craft migrate/all",
"@php craft project-config/apply",
"@php craft clear-caches/temp-files",
"@php craft clear-caches/compiled-templates",
"@php craft clear-caches/cp-resources",
"@php craft clear-caches/data",
"@php craft clear-caches/seomatic-frontendtemplate-caches",
"@php craft clear-caches/seomatic-metabundle-caches",
"@php craft clear-caches/seomatic-sitemap-caches",
"@php craft clear-caches/retour-redirect-caches",
"@php craft cloudflare/purge/purge-all"
],
"post-install-cmd": [
"@php craft migrate/all",
"@php craft project-config/apply",
"@php craft clear-caches/temp-files",
"@php craft clear-caches/compiled-templates",
"@php craft clear-caches/cp-resources",
"@php craft clear-caches/data",
"@php craft clear-caches/seomatic-frontendtemplate-caches",
"@php craft clear-caches/seomatic-metabundle-caches",
"@php craft clear-caches/seomatic-sitemap-caches",
"@php craft clear-caches/retour-redirect-caches",
"@php craft cloudflare/purge/purge-all"
]
}
}
|
Hey @angrybrad, @fvwanja fvwanja Did you try testing with smtp enabled? The issue does not seem to occur with sendmail. |
@seanconn yes SMTP is enabled in my case. |
Fair - there is a mention here: https://github.com/craftcms/contact-form#usage
Although I suppose it could be called out more. Those two fields (fromEmail and message) are required because an email needs a reply to address and body at a minimum.
That’s not a Contact Form requirement. All we require is that fromEmail and message are required and that fromEmail is an email address. See: https://github.com/craftcms/contact-form/blob/main/src/models/Submission.php#L66-L67 There are plenty of Contact Form plugins in the plugin store that hook into Contact Form events. Maybe you’ve got one installed that is adding extra validation or it’s coming from a custom module? |
You are the only one. You have the |
@LouisCuvelier sorry... I meant other plugins that extend our Contact Form plugin. If you’d like to send a database dump, your composer.json, and composer.lock files, and a front-end template over to support@craftcms.com along with steps to reproduce what you’re seeing, then we can dig in further. |
@angrybrad done ✅ Thanks |
@LouisCuvelier Your issue comes from the If you disable that plugin, the issue goes away for me. |
Annnnd you're right ! Thanks for the help 🙏 |
Hi,
Description
I can't make this plugin working since upgrading to Craft v4. The email is never send due to validation error.
Steps to reproduce
Firstly I thought my Twig code was wrong, so I copied/pasted the exact same example in readme on my page :
But the email never sends and in the log I still have this error :
2023-06-09 09:40:24 [web.INFO] [craft\contactform\Mailer::send] Contact form submission not saved due to validation error. {"memory":3736880}
I tried to debug a bit and It seems to come from the function
send()
(line 53 in SendController.php) that is calling the functionvalidate()
(line 47 of Mailer.php)When I comment the line 49 in Mailer.php, the emailing is sending correctly. So my SMTP settings are ok.
Any idea of what is happening ?
Additional info
The text was updated successfully, but these errors were encountered: