CodeIgniter Forums
Avoiding form elements caching ??? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Avoiding form elements caching ??? (/thread-48590.html)



Avoiding form elements caching ??? - El Forum - 01-22-2012

[eluser]veledrom[/eluser]
Hi,

I know that $this->output->cache(n); caches everything in the page. Is there anything I can do to avoid form elements being cached because they are unique for every users?

Thanks


Avoiding form elements caching ??? - El Forum - 01-23-2012

[eluser]Aken[/eluser]
I wouldn't cache the form part of the page, since things like validation and form repopulating are difficult with a cached form.


Avoiding form elements caching ??? - El Forum - 01-23-2012

[eluser]veledrom[/eluser]
That's what I am asking. How do I avoid it???


Avoiding form elements caching ??? - El Forum - 01-23-2012

[eluser]John_Betong_002[/eluser]
Try this:

Code:
# I am not sure of the count() value, you will have to check
if( ! isset( $_POST ) && count( $_POST ) < 2 )
{
  $this->output->cache(n);
}
&nbsp;
&nbsp;


Avoiding form elements caching ??? - El Forum - 01-23-2012

[eluser]veledrom[/eluser]
Yes but it avoids caching whole page if there is a POST data!

Let me start again: I want to cache everything in a webpage <b>apart from</b> its form elements.


Avoiding form elements caching ??? - El Forum - 01-23-2012

[eluser]John_Betong_002[/eluser]
&nbsp;
Try a Google search on "Phil Sturgeon partial cache"
&nbsp;
&nbsp;
edit: spelling