Skip to main content
14 votes

How can I check from a plugin config file if devMode is enabled?

For those coming here using Craft 3, it's now Craft::$app->getConfig()->general->devMode.
Nate Beaty's user avatar
8 votes
Accepted

How can I check from a plugin config file if devMode is enabled?

It's as simple as if ( craft()->config->get( 'devMode' ) ) { //do stuff }
Luke Pearce's user avatar
  • 3,863
6 votes

Looking for an advanced form plugin for Craft CMS

To answer your questions in regards to how they will fit with Freeform... If what you mean by pre-populating fields with existing data is being able to fill fields with data from other elements, ...
Solspace's user avatar
  • 1,410
4 votes

How to display success message using the Contact Form plugin

You can see in the code for the plugin on GitHub that it sets a 'notice': craft()->userSession->setNotice($settings->successFlashMessage); As the official documentation mentions, this can ...
Stephen Hamilton's user avatar
4 votes

Main email address for "Contact Us" in settings is not changing

If you are using the popular 'Contact Form' plugin, try Settings > Contact Form (under Plugins heading) and the field you want is the first field, 'To Email'. The variables in Globals are 100% ...
pixelace's user avatar
3 votes
Accepted

P/T ContactForm Retrieving Custom fields Value after submitting form

I just came across this question, for the sake of up to date info for others, it is now possible to do this with the latest release(1.7) of the ContactForm plugin from Pixel & Tonic: https://...
Jacob's user avatar
  • 282
3 votes

Multiple contact forms - Different recipients

But, is it possible to do this when there is another contact form on the site? Yes? If so, what do I need to add to the department dropdown code? The dropdown code shouldn't have anything to do ...
Brad Bell's user avatar
  • 67.5k
3 votes
Accepted

How to do an ajax submission to Craft Contact Form with attachments using FormData?

I have it working now using this: $('#Form').submit(function(ev) { // Prevent the form from actually submitting ev.preventDefault(); var formData = new FormData($(this)[0]); // Send it to the ...
SteveO's user avatar
  • 336
3 votes

Contact Form plugin email is not being received, not clear if it is being sent

There's a good article here for troubleshooting email errors and well as email deliverability issues: https://craftcms.com/support/troubleshooting-email-errors TL/DR: Don't use PHP's mail/sendmail ...
Brad Bell's user avatar
  • 67.5k
3 votes
Accepted

contactform.php messing up site

The problem is the ... in your contactform.php file. The docs use it because they assume you might have some other valid config settings you want to include in that config file, but it's not real ...
Brad Bell's user avatar
  • 67.5k
3 votes
Accepted

Recipients as dropdown with Contact Form Plugin

A custom dropdown that allows you to trigger emails to different departments is possible using Sprout Forms and the Sprout Fields Email Select field.
Ben Parizek's user avatar
  • 13.5k
3 votes
Accepted

Re-populate additional fields on Contact Form on failure of form validation

From the changelog: 1.7.0 Added the ability to access individual message fields values via message.messageFields when a validation error occurred. For example, the value of the input message[...
Sarah's user avatar
  • 46
3 votes

Integrate Google reCAPTCHA into Contact Form plugin

There are several anti-SPAM form plugins available for Craft that should work for you (including a Google reCAPTCHA one).
Brad Bell's user avatar
  • 67.5k
3 votes

Looking for an advanced form plugin for Craft CMS

I work with Sprout and can answer your questions with regards to Sprout Forms. 1. It should be possible to prepopulate fields with existing data This will happen by default in a lot of standard use ...
Ben Parizek's user avatar
  • 13.5k
3 votes

Unable to resolve the request "contactForm/sendMessage"

Your suspicion about the Craft 2 -> 3 migration is dead-on. Yii changed how action attributes work between versions 1 and 2 (used in Craft 2 and 3, respectively), so you'll need to update ...
August Miller's user avatar
2 votes

Recipients as dropdown with Contact Form Plugin

There isn't a way to do this natively with the plugin, so you'd end up having to fork the plugin and adding your own custom business logic. Currently the plugin is set to only send to one "To Email" ...
Brad Bell's user avatar
  • 67.5k
2 votes

How can I check from a plugin config file if devMode is enabled?

Since Craft 4.0, the recommended method to test if Craft is running in dev mode from the PHP layer is App::devMode(): use craft\helpers\App; $devMode = App::devMode(); Apart from App::devMode() ...
Mats Mikkel Rummelhoff's user avatar
2 votes
Accepted

ContactForm – How to make fields required

For form validation I typically use Parsley.js - it's dead easy to use.
CreateSean's user avatar
  • 1,983
2 votes

Integrate Google reCAPTCHA into Contact Form plugin

I recently had the same issue and fixed it by using Craft reCaptcha plugin. See: https://github.com/aberkie/craft-recaptcha
Sean Delaney's user avatar
2 votes
Accepted

Additional Fields aren't sent within Contact Form email

This issue is this: <textarea name="message" name="message[body]" cols="30" rows="6" placeholder="Questions or Comments"></textarea> You're defining name twice. The 2nd one gets ignored ...
Brad Bell's user avatar
  • 67.5k
2 votes

Contact Form: Name and Email in Message Body

I figured it out by duplicating the field... <input id="fromName" type="text" name="fromName" value="{% if message is defined %}{{ message.fromName }}{% endif %}"> {{ message is defined and ...
Jeff Fulton's user avatar
2 votes
Accepted

How to encrypt or hide variable/dynamic email address in contact form

You can Create a custom array in which you store all valid email addresses and send the id which email to use <select name="toEmail"> <option value="1">1st name</option> <...
Robin Schambach's user avatar
2 votes
Accepted

Contact form plugin only sending the content of the textarea?

When using multiple fields, you'll need to use message[body] for the main message field's name attribute. Passing just message as the name for your main text field will clobber your other custom ...
August Miller's user avatar
2 votes

Contact Form Setup on Craft CMS

Without an entry with slug contact/thanks then the page just returns an error Variable "entry" does not exist. But still it doesn't draw any content from the entry. You do not need to create an ...
Roi Agneta's user avatar
  • 1,463
2 votes
Accepted

Error with Contact Form plugin on submission

If you want to redirect to the same page as you are sending, you can remove {{ redirectInput('contact') }} as per here. Here though, it's the ContactFormExtensions plugin shouting at you. Do you have ...
Oli's user avatar
  • 7,495
2 votes
Accepted

Contact form not working since Firefox version update

Not sure I have the full picture yet, but as per the comments, the problem appears to be clear: I think I found the issue. Before, I was disabling the form first and then submitting it. That was ...
MoritzLost's user avatar
  • 11.5k
2 votes
Accepted

Exception 'yii\base\UnknownMethodException'

The problem is that this config file is for console commands as well as web requests. Console commands differ from web requests in that they don't have body parameters. For web requests, Craft::$app-&...
MoritzLost's user avatar
  • 11.5k
2 votes
Accepted

P&T Contact Form Plugin - How to Retrieve the inserted values?

The contact form controller creates a Submission model with the submitted values and provides it to the template as a message variable. You should be able to access this variable inside your template ...
MoritzLost's user avatar
  • 11.5k
2 votes
Accepted

contact-form human readable E-Mail template

What are you trying to output with the last loop in your template? With craft.contactFormExtensions.submissions you're iterating through submissions, not fields of a single submission. In the e-mail ...
MoritzLost's user avatar
  • 11.5k
2 votes
Accepted

Contact form plugin: Unable to verify your data submission (in Safari and Chrome)

If you're using any kind of caching such as Nginx fastCGI static caching/Blitz/Craft's {% cache %} tags/Varnish etc, then you'll need to find a way to generate a fresh CSRF token in the hidden CSRF ...
James Smith's user avatar
  • 5,344

Only top scored, non community-wiki answers of a minimum length are eligible