Juergen Posted August 21, 2017 Share Posted August 21, 2017 Hello @all, I have a problem by using the template cache on a template with a form. On a page I have a contact form, and I have defined cache deactivating variables to prevent loading the page from cache after form submission. I use query strings after the url: ?submit=success or ?submit=error (depending on the form validation). If I push the submit button, the page will be reloaded always with the same query string (in my case ?submit=error, because this is my default query string after submission). After the page reload the template cache is disabled, but the form values will not be sent to my email address. If I fill out the form once more (remember template cache is disabled at the moment) and I push the submit button everything works fine. So it seems that the template cache prevents values from beeing submitted. Does anyone have a working strategy to use template cache with forms? Thanks in advance Link to comment Share on other sites More sharing options...
Zeka Posted August 21, 2017 Share Posted August 21, 2017 Hi @Juergen First of all, you have to be sure that your defined setting in cache disable variables is correct. To test it try to put * in GET or POST field in settings and try to submit the form. Link to comment Share on other sites More sharing options...
Juergen Posted August 21, 2017 Author Share Posted August 21, 2017 Hi @Zeka thanks for your response, but it is the same behavior independent if I add "submit" or "*" in the GET or/and POST field. Link to comment Share on other sites More sharing options...
abdus Posted August 21, 2017 Share Posted August 21, 2017 Not a solution but on form pages I disable template caching and opt for WireCache class for caching small bits of markup, like fetching pages and creating an <select> etc. https://processwire.com/api/ref/wire-cache/ 1 Link to comment Share on other sites More sharing options...
Juergen Posted August 21, 2017 Author Share Posted August 21, 2017 Thanks @abdus, I know about this possibility, but I would prevent this. Another solution would be to load the forms via Ajax. For the moment I will leave the template cache disabled. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now