Hello,
I have and *Edit link* in 'index' and 'detail' view. I would like to
do a redirect after saving the data from edit form to one of that
views according from where the user access the edit form.
I'm trying it with using $this->referer() and saving it to session,
but it always redirect me to the 'index' view.
Sample code:
function edit($id = null) {
if (!$this->Session->check('redirectTo')) {
$this->Session->write('redirectTo', $this->referer());
}
$this->Theme->id = $id;
if (empty($this->data)) {
$this->data = $this->Theme->read();
}
else {
if ($this->Theme->save($this->data['Theme'])) {
$this->redirect($this->Session->read('redirectTo'));
$this->Session->del('redirectTo');
}
}
}
Probably I'm doing something bad :) Maybe there is be a better
solution, or some bult-in solution in Cake.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---