Friday, March 25, 2011

Re: force a redirect even if destination's page is equal to source's page

set 'value' => '' in your inputs on add.

On 25 March 2011 12:43, Mariano C. <mariano.calandra@gmail.com> wrote:
Nothin change.

On 25 Mar, 13:08, Stephen <step...@ninjacodermonkey.co.uk> wrote:
> unset $this->data ?
>
> On 25 March 2011 11:18, Mariano C. <mariano.calan...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > I have a form inside add.ctp view:
> > echo $form->create('...');
> > // ...
> > echo $form->submit('Save and back', array('name'=>'saveAndBack'));
> > echo $form->submit('Salva and add new',
> > array('name'=>'saveAndAddAgain'));
> > echo $form->end();
>
> > Now, add function inside controller is something like:
> > // grab button pressed inside add.ctp
> > $action = array_keys($this->params['form']);
> > $action = $action[0];
>
> > // use different redirect
> > if($action == "saveAndBack")
> >            $this->redirect(array('action' => 'index'));
> > if($action == "saveAndAddAgain")
> >            $this->redirect(array('action' => 'add'));
>
> > it seems to work, but when I insert a record and click saveAndAddAgain
> > (in this way I'm on add.ctp and all I want is to be redirected to a
> > new add.ctp) redirect doesn't happened, matter of fact form field are
> > still with last info's record.
>
> > What can i do?
> > Best regards
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Kind Regards
>  Stephen
>
>  http://www.ninjacodermonkey.co.uk

--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Kind Regards
 Stephen

 http://www.ninjacodermonkey.co.uk


--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: