Tuesday, November 4, 2008

Re: Ajax Redirect and setFlash Messages

Why do you need to redirect inside an ajax request? I've never run
into this requirement before.

Cheers,
Adam

On Oct 15, 6:33 am, Julián Lastiri <jlast...@gmail.com> wrote:
> Well, i found that when i call redirect from an ajax request the
> redirect is forwarded to the beforeRedirect method from RequestHandler
> Component. This
> method calls requestAction which sets bare in 1 and the dispatchers
> does the following
>
>                 if (!empty($this->params['bare'])) {
>                         $controller->autoLayout = false;
>                 }
>
> When autoLayout is set to false the view doesn't call renderLayout
>
>                         if ($layout && $this->autoLayout) {
>                                 $out = $this->renderLayout($out, $layout);
>
> Anybody knows how do i tell cakephp to set autoLayout to true when i
> call redirect from an ajax request ?
>
> thanks
>
> On Oct 14, 3:59 pm, Julián Lastiri <jlast...@gmail.com> wrote:
>
> > When i useredirectfrom anajaxrequest theajax.ctp is not rendered.
>
> > I try calling setFlash withgrowl layout but doesn't work.
>
> > I have a content div in my webpage. When i submit the form i save the
> > data, then set a Flash message andredirectto the index.
> > The index is loaded in the content div, but the message is not shown.
> > If i put some debug comments like echo "debugging" on theajax.ctp
> > layout theses comments are not printed.
> > So i suspect that the view is not rendering the layout properly.
>
> > any idea ?
>
> > On Oct 13, 10:18 pm, "Andras Kende" <and...@kende.com> wrote:
>
> > > this worked great for me:http://blog.jaysalvat.com/articles/afficher-vos-messages-flash-cakeph...
> > > delegantes-alertes-a-la-growl.php
>
> > > did it for both flash and validation..
>
> > > Andras
>
> > > -----Original Message-----
> > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> > > Of Julián Lastiri
> > > Sent: Monday, October 13, 2008 2:11 PM
> > > To: CakePHP
> > > Subject:AjaxRedirectand setFlash Messages
>
> > > I'm using cakephp 1.2RC3
> > > I want to show messages with setFlash method but when i useredirect
> > > theajax.ctp layout is not rendered.
> > > I'm using this code to show messages with jGrowl inside myajax.ctp
> > > layout
>
> > > <?php if ($session->check('Message.flash')): ?>
> > > <script>
> > > jQuery(document).ready(function(){
> > >         jQuery.jGrowl( "<?php echo $session-
> > > >read('Message.flash.message');?>", {
> > >                 life: 2000,
> > >                 sticky: false,
> > >                 header: '<?php echo $header;?>',
> > >                 theme: '<?php echo $message_class;?>'
> > >         });
> > > });
> > > </script>
>
> > > any idea ?
>
> > > thanks !
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: