I downloaded the simple_contact plugin and copied its stuff into the user/plugins/simple_contact folder. Modified and inserted the simple_contact.yaml into the user/config/plugins. These are the instructions available in its readme. To have a page with the contact created under user/pages a new folder ‘contact’ with contact.md in it that has:
title: 'Contact'
simple_contact: true
Now this throws a Template “contact.html.twig” is not defined ().
Searching this forum found that some code should be inserted maybe in the base template file… I’m a beginner begining to doubt that this simple_contact is the simple way to have contact form in the grav system. Your thoughts on it? What plugin do you recommand or just what am I missing here?
I haven’t tested simple_contact with the latest Grav release(s). However with the release of the form plugin, there is no need to use such 3rd party plugins anymore, since the simplest way is now to setup a contact form as describe here in Grav Learn Docs.
Hi!
Thanks for the tip! I just updated my grav so I now have the form plugin and according to the docs copied the form folder, form and formdata twig files to the template I use (woo). Now when I try the contact page it returns the md file as plain text, no input boxes. Tried with the antimatter theme, same thing.
I was updating manually, deleted the old site, copied the new grav system and inserted in the contents of user/pages and the woo template to the templates. Modified the original site and system yaml for site details. What could I be doing wrong?
Got it! The YAML frontmatter (where you define form and its parameters) must be between --- delimiters. I cannot paste them here as this forum interprets those, but add them before and after all the page content.
so make sure you add --- at the beginning and at the end of the page you had. Take a look at other skeletons if you need, to see the differences in your page and the others.
@obeliksz Glad you sorted it out! And you are right. Deleting the spaces in front of --- has to be done otherwise you get a YAML error. I added them here to fool the Muut forum editor to do not interpret them as start or end of the code.
Bump… how do I take this contact form to a modular page? Sorted out the
{% extends ‘partials/base.html.twig’ %} and {% block content %}
blocks so that now I get a white section on the modular page… I’m not sure if I sorted out correctly its “migration” to modular as in the modular directory inside forms/ I have the twig files calling out for {% extends “forms/default/form.html.twig” %} that is the path in the plugin folder, I don’t know if it gets that… Or where it gets stuck. And maybe you know a better way of doing this without copying and modifying the form twig files into the modular directory… Thanks in advance!
In your theme, add a templates/modular/form.html.twig file copying templates/forms/form.html.twig. -> together with formdata.html.twig and forms folder from the templates folder? Shouldn’t I edit first the form.html.twig to get rid of some code sections like
Create a modular folder with page type form.md -> copy the single page form.md into the modular folder that is near the modular.md file without a folder?
Add the form header to the main modular page, modular.md ? -> Thats the form tag from single page form.md with from:'s properties right?
In the form header, make sure you add the action parameter, with the modular page route -> as it this modular page is a home page it will be form: action: / another property to the form: header, right?