13 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.
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 }
  • 3,833
6 votes
Accepted

Adding a drop-down to Contact Form plugin

It's definitely possible, your HTML is just a little off... When dealing with a dropdown menu, the name attribute should be part of the select tag, not each individual option: <select name="...
  • 23.6k
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, ...
  • 1,390
5 votes
Accepted

How do you correctly handle errors using PT Contact Form when submitting via AJAX?

If you want the error messages to be displayed identical to P&T's template/macro default, this should do the trick: $(function(){ $('#ajax-form').submit( function(ev) { // Prevent ...
4 votes
Accepted

P&T Contact Form plugin: How can I copy "name" and "email address" in the body of the mail?

I ended up hacking the ContactFormService.php file with some extra code for the body It's actually quite simple: $email->body = "Sender: ".$message->fromName."\n\nEmail-addreas: ".$message->...
  • 1,042
4 votes
Accepted

ContactForm - Send a confirmation mail

Apparently someone made a plugin that's doing exactly that https://straightupcraft.com/craft-plugins/contact-form-receipts
  • 336
4 votes
Accepted

Contact Form plugin - Error loading 404 Pages

Anywhere you've currently got something that looks like this: {% if message is defined %}{{ errorList(message.getErrors('fromEmail')) }}{% endif %} Try changing that to: {{ message is defined and ...
  • 66.5k
4 votes

ContactForm - Send a confirmation mail

Make your own little plugin that listens to the plugin's contactForm.beforeSend event and sends the confirmation mail.
  • 35.9k
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 ...
3 votes

How to make fields required on the contact form?

You could also hand this over to HTML since it supports form validation as of version 5. Depends on your browser support requirements though. This is what “Can i use” says.
3 votes

Multiple contact forms different receiver(s)

No. It's currently not possible, but you could make this a feature request! If you don't have the time, you could fork the plugin and make the changes yourself.
  • 35.9k
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://...
  • 282
3 votes

P/T ContactForm Retrieving Custom fields Value after submitting form

In Craft 2.5 with Contact Form 1.4 I'm receiving the same error when using: {% if message is defined %}{{ message.contactTel }}{% endif %} I've gotten around this by using the Craft Request method ...
3 votes
Accepted

P&T Contact Form plugin: How to display error messages in other languages via Ajax

Well, the problem was that I was posting my Ajax request to / from all languages, therefore the site replied back with the site main language, which was French in my case. The following finally works:...
  • 301
3 votes
Accepted

Contact Form Plugin: Validate if a checkbox is checked?

There's no clean way doing this without making changes to the plugin itself. The contactForm.beforeSend event makes it possible to prevent the email from being sent from another plugin, but you're ...
  • 35.9k
3 votes

Contact Form not sending

I figured out what was happening. There was a conflict with a previously installed plugin, Sprout Invisible Captcha.
  • 326
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.
  • 13.3k
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 ...
  • 66.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 ...
  • 326
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 ...
  • 66.5k
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 ...
  • 66.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[...
  • 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).
  • 66.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 ...
  • 13.3k
3 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% ...
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 ...
2 votes

P&T Contact Form plugin: How to display error messages in other languages via Ajax

There may be a better answer, or one forthcoming, but why don't you try using translation files? Note that the translations in the file can be any phrase, not just single words, so should fit well ...
  • 1,697
2 votes

P&T Contact Form plugin: How can I copy "name" and "email address" in the body of the mail?

Your options are either: 1) Hack the plugin to get it to add name and email to the body. 2) Use a more robust form-building plugin. 3) Use JavaScript to add a hidden input to the page that will add ...
  • 66.5k
2 votes

ContactForm - Send a confirmation mail

Just saw this, it is possible without building a plugin by hacking the standard contactform plugin. In the file contactformservive.php add: $email->cc = array( array('name' => $message->...
  • 1,042

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