I am just getting to grips with Craft CMS and am finding the Contact Form plugin tricky to use. I have built a reasonable site structure, figured how fields, sections, etc work at a relatively basic level and have produced a one-for-all template so far in the templates/ root folder. But the form eludes me.

I have added the contact form example from https://github.com/craftcms/contact-form to the main template at present, and this shows on my /contact/ page. However, the submission of the form returns an error as follows:

Template not found: contact/thanks

I would assume I need to make a section/entry for the contact/thanks page? So I have now done that. The form submits but just goes to a blank page at contact/thanks even though I have created content on that entry. It's not drawing any of the data items specified in the Twig template.

It also does not send an email. I have implemented and tested the Settings > Email webserver details successfully. But all submissions are being collated in the "Form Submissions" area (Contat Form Extensions plugin).

I note that the form has no action, but the hidden field below exists:

<input type="hidden" name="action" value="contact-form/send">

Do I need to create a page for contact-form/send too? I have clearly made the naive assumption that the plugin would sort the sendmail part but some action is required on my part.

Sorry, I'm a noob. Guidance appreciated.

I would assume I need to make a section/entry for the contact/thanks page?

Not necessarily. You could just make a templates/contact/thanks.html file and that would resolve. You can also change that value to whatever you want:

{{ redirectInput('neato') }}

And you'd put a templates/neato.html file in place it would load.

Do I need to create a page for contact-form/send too?

I'm not familiar with the Contact Form Extensions plugin, but if the submissions are making it into the database, then that contact-form/send controller endpoint is probably being hit properly.

If your email settings are working properly under Settings->Email in the Control Panel (you can test with the "Test" button), then there can be other reasons why emails aren't being delivered you could check:

https://craftcms.com/guides/troubleshooting-email-errors#dealing-with-email-delivery-issues

https://craftcms.com/guides/why-doesnt-craft-send-emails

  • Hmm, I'm obviously missing something. 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. Whether I use the default template or one specific to that page. – WWD Nov 9 at 1:23
  • Also, when the contact form is submitted the first time, it also shows "Variable "entry" does not exist." for the first entry item in the (default/root) template. The page URL is /contact/ not contact/thanks. Reloading the page takes me to the blank, but correctly templated page with url contact/thanks. Only globals are populated in the template. A submission is recorded for both the first page load and the Confused. – WWD Nov 9 at 1:29

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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