Forums

confirm back not showing the data

Minnie Mouse 12 Mar, 2010
hi, i have a confirm page that is almost working. however, when you click back the user input isnt retained... is this a bug? how can i retain the user data already input?

thanks, MM
Minnie Mouse 12 Mar, 2010
hi Fredrick, thanks for this, but when i take this code:
<?php
JResponse::allowCache(true); /* Tell Joomla it's ok to cache... */

/* But set our own headers to limit the lifetime of the form page */
JResponse::setHeader('Expires', gmDate('r', strtotime('+ ' . JSession::getExpire() . ' minutes')), true);
JResponse::setHeader('Cache-Control', 'private', true);
?>

and put it in my form code header i get this error when i try to save it:

Fatal error: Using $this when not in object context in /home/rockridg/public_html/libraries/joomla/session/session.php on line 177
i think it doesnt like the JSession:getExpire() function...
Minnie Mouse 12 Mar, 2010
so i tried this instead:
<?php
JResponse::allowCache(true); /* Tell Joomla it's ok to cache... */

/* But set our own headers to limit the lifetime of the form page */
JResponse::setHeader('Expires', gmDate('r', strtotime('+1 day')), true);
JResponse::setHeader('Cache-Control', 'private', true);
?>

removing the JSession and adding my own offset (1 day)
but it doesnt work... it saves with no error but the form data is not saved when you go back to edit your order.
nml375 12 Mar, 2010
Hi MM,
Could you post a link to the form?

/Fredrik
Minnie Mouse 12 Mar, 2010
DOH, i just was looking around to do something else and found in the general settings, settings for republish fields and renew form instance. both were set to not retain the form data. i did that and voila! it works! sorry to be so lame. thanks for your help!

i still have the cache code in my header. do i need that still?
MM
nml375 12 Mar, 2010
Hi MM,
Ahh, think I mis-understood your query then. The cache-code would be used to allow the browser navigation buttons (Back) to retain form data, though I see now you were talking of form navigation buttons. The cache-code is not needed for the republish function.
Unless you have a habit of editing your form on a daily basis, the cache-code should'nt do any harm though.. (it simply tells your browser that it's safe to use a cached version of the form for a limited time while using navigation functions).

/Fredrik
Minnie Mouse 12 Mar, 2010
ahhh... and i mis-misunderstood your reply as well... that is much clearer now. i think leaving that code in there makes sense, as undoubtedly some people will hit the browser back button too. thanks for your help!! MM
This topic is locked and no more replies can be posted.