Erratic behavior of form+cache in modular page


#1

Hi,

My forms either show 404 error after submission or , if cache cleared, it shows summary of first submission. If i submit a second form, the summary is the same as the first (emails received show the correct content). Cache is disabled in modular form and parent pages.

Decided to remove summary, so the present steps are:
1 - Submit form
2 - Received correct form in email

  • No success message in page with form*
    3 - Clear cache
    4 - Refresh page with form
  • Sucess message with fields filled with last submission *
  • Any submission after that, shows always the first one *

I have AdvancedPageCache and PreCache installed and deactivated at this moment.

Page:



title: 'Dados de contacto'
cache_enable: false
form:
    name: contact-form
    action: /contactos
    fields:
        -
            name: name
            label: Nome
            placeholder: ''
            autofocus: 'off'
            autocomplete: 'off'
            type: text
            validate:
                required: true
        -
            name: email
            label: Email
            autofocus: 'off'
            placeholder: ''
            type: email
            validate:
                required: true
                pattern: '^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,10}$'
        -
            name: message
            label: Mensagem
            type: textarea
            autofocus: 'off'
            placeholder: ''
            validate:
                required: true
        -
            name: rgpd
            label: 'Permissão RGPD'
            type: radio
            default:
                politica-de-privacidade: false
            options:
                aceito: 'Concordo com o tratamento dos meus dados, segundo descrito na política de privacidade'
            validate:
                required: true
        -
            name: permissions
            label: Notícias
            type: checkboxes
            default:
                news-eo: false
                news-epoch: false
            options:
                news-eo: 'Gostaria de receber informações adicionais sobre a actividade da Epoch Online'
                news-epoch: 'Gostaria de receber informações adicionais sobre o grupo Epoch'
            validate:
                required: false
        -
            name: how
            label: 'Como chegou até nós?'
            type: checkboxes
            default:
                Facebook: false
                Google: false
                Amigo: false
                Mkt: false
                Outro: false
            options:
                Facebook: Facebook
                Google: 'Motores de Busca'
                Amigo: 'Amigo ou Colega'
                Mkt: 'Campanha de Marketing'
                Outro: Outro
            validate:
                required: false
        -
            name: telephone
            type: honeypot
    buttons:
        -
            type: submit
            value: Enviar
    process:
        -
            email:
                from: '{{ config.plugins.email.from }}'
                to:
                    - '{{ config.plugins.email.from }}'
                    - '{{ config.plugins.email.to }}'
                    - '{{ form.value.email }}'
                subject: '[Feedback] {{ 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!'


Twig:

<section class="container {{ grid_size }}">
    <div class="columns">
        <div class="column {% if (header.extra_info) %}col-6  col-mx-auto{% else %}col-8 col-mx-auto{% endif %}  col-sm-12">
            {{ content }}
            {% if not header.formulario %} {% include "forms/form.html.twig" %} {% endif %}
            <div id="erro" style="position: absolute;"></div>
            <div id="repost"></div>
        </div>
        {% if (header.extra_info) %}
        <div class="column col-4 col-sm-12">
                {{ header.extra_info|markdown }}
        </div>
        {% endif %}
    </div>
</section>

Any help is appreciated.
Thank you.
Pedro


#2

So, at this point turned the cache off (config) and forms are working as expected…
The speed wasnt much affected.

Will need more tests.
Any ideas, are more than welcome.

Cheers
Pedro