Search code examples
grav

Grav form redirection


Dear stackoverflowers,

on the site iam currently developing there is a contact form on each subpage – form included from the /contact subpage.

Iam able to send the form on each site, but it includes the /thankyou page in the content block and replaces the main content of the site. So iam still on /home page for example.

Now i want to redirect to /contact when submitting – so that the /thankyou page replaces the /contact content.

I tried to add - redirect: '/contact' to the form markdown file. But that just redirects me to /contactand not submitting the form to the server.

Any ideas?

I used that form Example from the Grav Documentation and that twig file for displaying the thankyou message.

Thank you guys.
Karl


Solution

  • I just solved my problem.

    add action: '/contact' to the form and also leave the process: - display: '/thankyou.

    What happens is that it first redirects to /contact and includes /thankyou afterwards.

    The only negative thing is that, when the validation fails, it still redirects you to /contact. But i think that is unsolvable.