244863 Posted October 5, 2011 Share Posted October 5, 2011 I have the controller below and when I use the edit page the redirect works and takes me to the right page. But when I go through the add page it does not???? <?php class GrievanceTypesController extends GrievanceAppController { function add() { $this->edit(); $this->render('edit'); } function edit($id = null) { $this->helpers = am($this->helpers, array('Form')); $grievanceTypeGroupId = $this->params['named']['grievance_type_group_id']; $this->set('grievanceTypeGroupId', $grievanceTypeGroupId); if($this->GrievanceType->GrievanceInitiation->typeHasGrievances($id) == true){ $this->flash( sprintf( __('The %s, "%s", can not be edited.', true), $this->_humanisedModelName(), $this->GrievanceType->field('title') ), array('controller' => 'grievance_type_groups', 'action' => 'view', $this->GrievanceType->field('grievance_type_group_id')) ); }else{ $this->_edit($id, array('redirect' => array('controller' => 'grievance_type_groups', 'action' => 'view', $this->GrievanceType->field('grievance_type_group_id')))); } } function delete($id = null) { if($this->GrievanceType->GrievanceInitiation->typeHasGrievances($id) == true){ $this->flash( sprintf( __('The %s, "%s", can not be deleted.', true), $this->_humanisedModelName(), $this->GrievanceType->field('title') ), array('controller' => 'grievance_type_groups', 'action' => 'view', $this->GrievanceType->field('grievance_type_group_id')) ); }else{ $this->_delete($id, array('redirect' => array('controller' => 'grievance_type_groups', 'action' => 'view', $this->GrievanceType->field('grievance_type_group_id')))); } } } ?> Link to comment https://forums.phpfreaks.com/topic/248482-cakephp-redirect-not-working/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.