This doesn't work
I have an edit method and a fu method - both do database saves.  BUT
the cake automagic stuff always sends the user back to the edit method
after fu save operation - this looks like a bug

Danny

On Mar 9, 2:52 pm, grigri <j...@hendersonwebdesign.com> wrote:
> I did just this a while ago; it worked fine for my purposes:
>
> $this->redirect($this->referer());
>
> However, there was a problem. If, after editing an item, it appears in
> a different page, then it just won't work.
>
> Example: your index is listed alphabetically. You're on page 3, and
> click edit on the entry "Curried Animals: Aardvark to Zebra". You edit
> this to "Aardvark to Zebra: A guide to wild curries". It returns you
> to page #3 but your entry is now on page #1. Is this the expected
> result?
>
> It might be in some cases, and not in others. One of my clients
> remarked that it _wasn't_ what they wanted, because it made what they
> were doing slower.
>
> I have taken to having a dropdown, similar to the one PhpMyAdmin
> offers, where the user can select the next action. "Back to index",
> "Find this item", "View this item", "Edit again", "Add new", ... not
> all items on each edit, of course, only the relevant ones. The
> redirect functionality is in a component (which also generates
> appropriate data to set in the <select> options).
>
> hth
> grigri
>
> On Mar 9, 10:26 am, Danny Lieberman <onlyj...@gmail.com> wrote:
>
> > This would seem to be a trivial task.  I have a list of paginated
> > rows.   I want to be able to click on an edit operation on a
> > particular page > 1 and return to the same page.  I save the referer
> > on entry to the function and redirect to the saved referer after the
> > database save operation - but the controller always returns to the
> > controller index method no matter what the user chooses.
>
> > I'm running in production mode - perhaps this is related to debug=0?
>
> > Here is the code:
> >         function fu($id = null) {
> >                 $refer = Controller::referer();    // save the calling
> > page
> >                 if (!$id && empty($this->data)) {
> >                         $this->Session->setFlash(__('Invalid Contact',
> > true));
> >                         $this->redirect(array('action'=>'index'));
> >                 }
> >                 echo $refer;
> >                 if (!empty($this->data)) {
> >                         if ($this->Contact->save($this->data)) {
> >                                 $this->Session->setFlash(__('The
> > Contact has been saved', true));
> >                 //              $this->redirect(array
> > ('action'=>'index'));
> >                                 $this->redirect($refer); // redirect
> > back to the calling page after save
> >                         } else {
> >                                 $this->Session->setFlash(__('The
> > Contact could not be saved. Please, try again.', true));
> >                         }
> >                 }
> >                 if (empty($this->data)) {
> >                         $this->data = $this->Contact->read(null, $id);
> >                 }
> >                 $this->set('contact', $this->Contact->read(null,
> > $id));
>
> > Looks like something really stupid is breaking this but I cant figure
> > out what
>
> > Danny
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to