I figured it out!

used:
$this->autoRender = false;
$this->render('x action');
$this->requestAction('x action',array('return'));

Not sure why not rendering the original page solves the session errors
but it works.

On Sep 26, 1:24 pm, Jimbo2150 <[EMAIL PROTECTED]> wrote:
> I have a form that has options like add, edit, remove, etc.
> I want it to 'redirect' to the action when the form is submitted:
>
> if add
>   render and use function add
> elseif edit
>   render and use function edit
> etc.
>
> Using
> $this->render('x action');
> $this->requestAction('x action');
> works, but it throws errors about the output killing the session
> cookie/header.
>
> Using just
> $this->requestAction('x action')
> will still output the original view from display (which is not what I
> want in some cases, I want 'x action's view.
>
> Using
> $this->redirect('x action')
> goes to the action, but looses all form data since it is redirecting
> the browser (required for some actions).
>
> Is there any easy way to alter the view and action within a function,
> I want something like this:
>
> function display() {
>   //---> if form submitted, continue
>   switch $this->params['form']['action'] {
>     case 'add':
>       $this->redirect('add action');
>       break;
>     case 'del':
>       // redirect to del action while keeping form data and session
>       // Note: view needs to change as well as action
>       break;
>
>   // etc.
>   }
>
> }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to