1

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.

0

3 Answers 3

2

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 entry for the Thanks page - in most cases it is easier to just add the actual text to your template file. If you do want to make it editable, then create a Single Entry, name it whatever you want, then go to Settings > Sections > yourSection and edit the uri and path variables. The URI should be contact/thanks, and the template path would likely be something like thanks.html

1
  • this issue fix it but i want to ask again becuse little bit confuse why not receive mail in mailtrap,after sucess message. Commented Jun 6, 2019 at 11:36
1

I had the same problem and I found out - it is necessary to create a route.

You have two options for that:

  1. Entry (single) with slug
  2. Custom Route

Thats because redirectInput() redirect to an url. But without a route - you just can not access the template tree. Thats the whole point of a routing system.

I would love to see a custom route created (and configurable) by this plugin. But ok, I have it now.

0

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

3
  • 1
    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
    Commented Nov 9, 2018 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
    Commented Nov 9, 2018 at 1:29
  • I have the same issue - without an entry with slug - I get an template not found error.
    – Slowwie
    Commented Sep 3, 2020 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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