Configuration to display 'Thank you' in modular contact form

Hi.

I’m developing a web with theme Hola, and it’s configurated as a modular page, with the contact form in it. I’ve set the smtp credentials in email plugin, captcha in form plugin, and my .md file and template are correct. The form works correctly.

However, I can’t get to show the ‘Thank you’ page. The form shows a hidden div with the FORM_ALREADY_SUBMITTED when it sent data.

My pages structure is this:
01._home

06._contact
contact.es.md
/gracias
formdata.es.md

The formdata.html.twig is in the root folder of the theme (child theme).

The code of my files is this:

form:
    name: contact-form
    template: form-messages
    refresh_prevention: true
    fields:
        -
            name: Nombre
            label: false
            placeholder: Nombre
            validate:
                required: true
                message: 'Este campo es obligatorio'
            autofocus: 'off'
            autocomplete: 'on'
            type: text
            outerclasses: form-field
            classes: full-width
        -
            name: Email
            label: false
            placeholder: Email
            validate:
                required: true
                message: 'Este campo es obligatorio'
            type: email
            outerclasses: form-field
            classes: full-width
        -
            name: Asunto
            label: false
            type: text
            placeholder: Asunto
            validate:
                required: true
                message: 'Este campo es obligatorio'
            outerClasses: form-field
            classes: full-width
        -
            name: Mensaje
            label: false
            placeholder: Mensaje
            validate:
                required: true
                message: 'Este campo es obligatorio'
            type: textarea
            outerclasses: form-field
            classes: full-width
            rows: null
        -
            g-recaptcha-response: null
            label: Captcha
            type: captcha
            recaptcha_not_validated: '¡Captcha no válido!'
    buttons:
        -
            type: submit
            value: Enviar
            outerclasses: form-field
            classes: 'full-width btn--primary'
    process:
        captcha: true
        save:
            fileprefix: contact-
            dateformat: dmY-His-u
            extension: txt
            body: '{% include ''forms/data.txt.twig'' %}'
        email:
            subject: '[Formulario de juanvillen.es] {{ form.value.name|e }}'
            body: '{% include ''forms/data.html.twig'' %}'
        display: /gracias

Note: (I’ve tested with display: gracias, without ‘/’)
I don’t know where is the fail.
Could help me somebody?

I attach some screenshots:

Thanks

I hope my suggestions are still relevant to you, so here they are.

First try your current solution with the standard Quark theme. If it does work then there is something strange with the Hola theme. If it doesn’t work then try to make the thankyou (“gracias”) page a child page of your contact form and change display: /gracias to display: gracias. That is like the Example Contact Form.

Hello there,

First of all, thanks for your help. I’ve made a copy of default.html.twig, from Hola theme, and I’ve called it gracias.html.twig. After that, I’ve made a page call Mensaje enviado (sent message) with the content I want to display when someone sends an message from my form.

Finally, in my contact.md page, I’ve had the following code (only the affected part):

process:
        captcha: true
        save:
            fileprefix: contact-
            dateformat: dmY-His-u
            extension: txt
            body: '{% include ''forms/data.txt.twig'' %}'
        email:
            subject: '[Formulario de juanvillen.es] {{ form.value.name|e }}'
            body: '{% include ''forms/data.html.twig'' %}'
        reset: true
        display: /gracias

This works correctly, but I with this method I can’t show in my gracias.html.twig the results of content sent (with formdata.html.twig).

The code of gracias.html.twig is:

{% extends 'partials/base.html.twig' %}

{% block content %}
    <section class="small-page-header page-hero" style="background-image:url({{ url('theme://images/default.jpg') }}">
        <div class="row page-header__content narrow text-center">
            <h1 class="page-header__title">
                {{ page.title }}
            </h1>
        </div>
    </section>

    <section id="default" class="s-default">
        <div class="row narrow section-intro">
            <div class="col-full">
                <div>
                    {{ content }}
                    
                </div>
                </div>
            </div>
        </div>
    </section>
{% endblock %}

I hope you help me in that question.

Thanks so much.

I think you need to use the formdata template for your thankyou page.
See the docs on Form Actions and then the section Display.

Thanks,

I’ll try it.