Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Using Form Plugin in modular pages

Started by Nico Petri 9 years ago · 2 replies · 1320 views
9 years ago

Hello there,

i am a little bit confused abt setting up a form within a modular page.

This is my setup:

/usr/pages/01.home/ .. _contact.md /form-thx/form-thx.md ..

Within the the _contact.md i have definied the form in the frontmatter. The corresponding twig file contact.html.twig looks like this:

TWIG
<section>
...
{% include "forms/form.html.twig" with { form: forms('contact-form') } %}
...
</section>
<section>
...
</section>

The email is send correctly, but grav couldnt find the thanks page.

Display page not found. Please check the page exists.

Any thoughts?

Thanks in advance!

9 years ago

Hi
You might find it easier just to display a message on the current screen rather than redirecting to another page. In your contact-form.md add in a message section - then this text will display on the contact form page. for example:

HTML
   process:
        -
            email:
                from: ......

        -
            message: '<div class="row"><div class="col-xs-10 col-xs-offset-1"><div class="form_submission">Message sent! </div></div></div>'
---

otherwise basically you will need to create another "thankyou" folder inside your 01.home folder with a formdata.md file in it for the thank you page. The steps for form setup in pages are here: Example Forms There is a link to the modular form setup from that page.

All that said, probably the most useful is the example theme where you can really see the folders and subfolders in action: Deliver Theme - modular form

👍 1
9 years ago

Hello C64,

u still code on a C64? LOL.

Thank u very much. I changed the folder's location and it works now. I will also try the the 2nd solution and check out the deliver theme.

Have a nice day...

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 43 1 week ago
Plugins · by Xavier, 4 weeks ago
2 53 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1179 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 48 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 72 2 months ago