Form loading issues

I am confused about how forms are supposed to be configured.
Do I need to use “cache_enable: false” on the form itself?

The problem I have is that often the site gets stuck on the “thankyou” page. I created an order form with a thankyou page, just like the contact form (the site now has two form pages total), however this new form is not behaving. Many times the thankyou page does not show after submission, and other times it does but then it gets stuck there, even if I navigate away and go back to the order form from the navbar. So something is up with caching I’m guessing but it’s not clear to me what the best practice actually is. Examples show “cache_enable: false” on the thankyou page but not the form itself. Can someone explain this pattern to me?

I really could use some help on this. I am getting a bit crazed trying to figure out why my form does not behave properly. It does two things:

  1. Does not go to the thankyou page after submission most of the time.
  2. When it does go to the thankyou page, it gets stuck on it, no matter how I adjust the cache settings. I cannot reload and get the form again.

I’ve followed the guidelines for basic forms, and under “process” it looks like this:

process:
    email:
        subject: '[Order Form] {{ form.value.name|e }}'
        body: '{% include ''forms/data.html.twig'' %}'
    message: 'We will contact you to confirm soon.'
    display: thankyou

I removed the “save” part since I don’t want local files to be created from the form.

For the oder form, I’ve tried adding “cache_enable: false” but that didn’t help so I removed it again. Only the thankyou page has that, as shown in the docs.

I tried enabling debugging for both the order form and the thankyou page, but nothing shows when submitting.

All I want is:

  • The form sends the email and shows the thankyou page.
  • If I reload, or navigate away and return, the form shows again.

Advice would be appreciated!

There must be something else which is preventing normal Form behaviour.

You could disable non essential plugins (other than Login, Forms, Problems and Admin if you’re using the Admin plugin). Does the thankyou page work if you leave out the email sending? Can you try with another fresh Grav install? Are you using a third party or custom theme?

Those are the things you should consider and try. Good luck!

1 Like