Using Form Plugin in modular pages

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:

<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!

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:

   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 Like

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…