Contact form - 400 display page not found

Hi,

I’ve created a modular page with a contact form in it. The form sends the email OK, but for some reason, it gives a Server Error after it redirects to contact/_contact

Folder structure:

_Contact (form.md)
_showcase
_map
_Contactdetails (some icons, etc. no form)
thankyou
modular.md

modular MD:

---
title: 'Contact Form'
menu: Contact
onpage_menu: false
body_classes: 'modular header-image fullwidth'
form:
name: contact
fields:
    - name: name
      label: Name
      placeholder: Enter your name
      size: x-small
      autofocus: on
      autocomplete: on
      type: text
      validate:
        required: true

    - name: Company
      label: Company
      placeholder: Company
      autofocus: on
      autocomplete: on
      type: text
      validate:
        required: true

    - name: email
      label: Email
      placeholder: Enter your email address
      type: email
      validate:
        required: true

    - name: message
      label: Message
      placeholder: 'Enter your message'
      type: textarea
      validate:
        required: true


    - name: g-recaptcha-response
      label: Captcha
      type: captcha
      recaptcha_site_key: 134
      recaptcha_not_validated: 'Captcha not valid!'
      validate:
      required: true
buttons:
    - type: submit
      value: Submit
    - type: reset
      value: Reset

process:
    - captcha:
            recaptcha_secret: 1234
    - email:
        from: "{{ config.plugins.email.from }}"
        to:
          - "{{ config.plugins.email.from }}"
          - "{{ form.value.email }}"
        subject: "[Website] {{ form.value.name|e }}"
        body: "{% include 'forms/data.html.twig' %}"
    - save:
        fileprefix: feedback-
        dateformat: Ymd-His-u
        extension: txt
        body: "{% include 'forms/data.txt.twig' %}"
    - message: Thank you for your message!
    - display: thankyou

content:
items: '@self.modular'
order:
    by: default
    dir: asc
    custom:
        - _showcase
        - _contactdetails            
        - _map

---

Because you wrote display: thankyou, it will look for a page under your modular page (example: yoursite.com/contact/thankyou.
However, your thankyou page is at the root of your folder structure (if I can read it correctly).
To make it work, you therefore have to add a /.
This should work: display: /thankyou
More info here: https://learn.getgrav.org/forms/forms/reference-form-actions#display

Doh. as simple as that! Much appreciate :slight_smile:

You are very welcome, if you have no other questions, you can mark this one as solved :slight_smile:

Paul

How do i mark as resolved?

Hello,

At the end of the discussion, you have just to click on image

the button bar looks like : image

I dont seem to have that option? I’m using Firefox.