So I have a materials controller and I am trying to save the weight of a material and then redirect to the instructions action in the formulas controller. I know its getting to the
if($this->request->is('post')) {
IF/Then construct because I have put echoes in it but after it saves it ends up not redirecting and just goes to a blank page where the URL is
/formulas/edit/2
which makes it seem like its just truncating the formulasId from the URL. When it gets to that point it shows up blank and when I view
Here is my code below:
function edit($id = null, $formulaId = null) { $this->Formula->id = $id; $this->Formula->formulaId = $formulaId; $this->set('formulasId', $this->Formula->formulaId); if($this->request->is('post')) { $this->Formula->save($this->request->data); $this->redirect('/formulas/instructions/' . $formulaId); } if($this->request->is('get')) { debug($this->data); $this->request->data = $this->Formula->read(); } else if($this->Formula->save($this->request->data)) { $this->redirect(array('action' => 'instructions', $formulaId)); } }
My view is:
<?php echo $this->Form->create('Formula', array('action' => 'edit')); echo $this->Form->input('weight'); echo $this->Form->input('id', array('type' => 'hidden')); echo $this->Form->input('formulasId', array('type' => 'hidden')); echo $this->Form->end('Save'); ?>
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:
Post a Comment