Forums / Setup & design / cache problem in templates including forms

cache problem in templates including forms

Author Message

Mads Ovesen

Wednesday 21 December 2005 4:25:16 am

Hi,

I have a template that contains a form, for which I need to disable the cache. I have tried both

{set-block scope=root variable=cache_ttl}0{/set-block}

and

{cache-block expiry=0}
template with form
{/cache-block}

, but nothing seems to work. What am I missing??

/m

Mads Ovesen

Wednesday 04 January 2006 8:54:05 am

The problem is that everything typed in the fields the first time is cached. If a user makes a spelling mistake or does not fill in a required field before the form is submitted, the first typed in values are always cached.
For example, I have experienced the following:
A user has typed in some values in all the required fields except one. As the user presses submit, the form is validated and an error is reported. Another user types in values slightly after and also makes a mistake. As he presses submit, an error is reported, and the values from the first user is shown in the fields. Hope this makes sense. I have experienced other problems related to this.

This only happens when the template cache is enabled. I have tried everything with cacheblocks in the template and time-to-live variables, but nothings seems to work, when there is a form in the template.

/m

Paul Forsyth

Wednesday 04 January 2006 10:17:29 am

It may be a form redirect causing this issue. When you get a validation error it may redirect to a template where you havent disabled the cache.

Switch on template debugging and confirm that you are being redirected to the template you expect.

Paul