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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 04:15:03
Script start
Timing: Jan 31 2025 04:15:03
Module start 'layout'
Timing: Jan 31 2025 04:15:03
Module start 'content'
Timing: Jan 31 2025 04:15:03
Module end 'content'
Timing: Jan 31 2025 04:15:03
Script end

Main resources:

Total runtime0.0219 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.2656151.2266
Module start 'layout' 0.00500.0025 739.492236.6797
Module start 'content' 0.00750.0130 776.171990.2031
Module end 'content' 0.02060.0014 866.375029.9922
Script end 0.0219  896.3672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002411.0668140.0002
Check MTime0.00115.1905140.0001
Mysql Total
Database connection0.00083.577710.0008
Mysqli_queries0.00219.629030.0007
Looping result0.00000.054310.0000
Template Total0.00104.810.0010
Template load0.00083.669010.0008
Template processing0.00021.071610.0002
Override
Cache load0.00052.470310.0005
General
dbfile0.007534.164480.0009
String conversion0.00000.035940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs