Dividing the form into two actions, one to display and one to save,
did the trick. Thanks for the help, 0x20h. I appreciate it.

On Oct 30, 12:11 pm, 0x20h <k...@informatik.uni-marburg.de> wrote:
> When beforeFilter() gets called cake is already rendering the "cached
> version".
> (see dispatcher::cached() and ViewHelper#__writeFile()).
> Regarding to the docs its not recommended to use the callbacks 
> (http://book.cakephp.org/view/1380/Caching-in-the-Controller) .
> I would probably try to separate the "display" and "save" part into 2
> actions or put theforminto an
> element andcachethat element manually, not via cacheAction.
> e.g. in your view script
>
> if($this->data || !($content =Cache::read('big_form', 'persistent'))) {
>     $content = $this->element('big_form');
>     if (!$this->data) {
>        Cache::write('big_form', $content, 'persistent');
>     }}
>
> echo $content;
>
> Am 30.10.2011 19:26, schrieb BlenderStyle:
>
>
>
>
>
>
>
> > I have setup the index and edit actions to be cached in my
> > PostsController as follows:
>
> > var $cacheAction = array(
> >    'index' => array('callbacks' => true, 'duration' => '7 days'),
> >    'edit' => array('callbacks' => true, 'duration' => '7 days'),
> > );
>
> > Everything is cached as expected, but the editformdoesn'tsubmit.
> > This is expected as well, if you think about it, but is there anyway
> > to bypass caching when a user submits aform?
>
> > I set callbacks to true to allow AuthComponent to do its magic, so if
> > I could put some code in beforeFilter(), it's executed dynamically
> > (not cached). I have tried each of the following in beforeFilter(),
> > one by one, but none of them did the trick:
>
> > if(!empty($this->data)) clearCache();
> > if(!empty($this->data)) Configure::write('Cache.check', false);
> > if(!empty($this->data)) $this->cacheAction = false;
>
> > To avoid the "why would you even want to do that" argument I see in
> > other forums, I'll explain a little further. My edit action is fairly
> > intensive since it's such a longformwith a lot of "stuff" in it and
> > caching definitely improves the performance. To avoid writing extra
> > code, the edit action displays theformas well as saves it.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to