Friday, November 18, 2011

Redirect depending on form field

I am trying to get page redirected (after add or edit) depending on a
field of the form. Here is what I have done so far:

View:
...
$back_link = array('action' => 'browse', $this->Form-
>value('Post.parent_id'));
echo $this->Form->hidden('redirect_id', array('value' =>
json_encode($back_link)));
...

Controller:
...
$redirect = (array)json_decode($this->data['redirect_id']);
$this->redirect($redirect);
...

When I pr() the $redirect , everything looks just as it should but i
get redirected to the browse action without any id after it.
How to make this working, is it necessary to use separated fields in
the view for controller, action, id. Or if you can advise any other,
more simple method to do this. Thanks

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate