Jon Chin
brian wrote:
That's a bit difficult to follow. At what point are you calling _processMerit()? And you have an empty block inside wizard()? Is that on purpose? You have a couple of instances with $this->Merit->save($this->data) but I only see where you're reading data from the DB for Application. hich model are you working with? Sorry, I've never used the WizardComponent so this is a bit opaque to me. On Sat, Jun 20, 2009 at 2:06 AM, Jon Chin<j...@boogly.net> wrote:Here's the code. I still can't get it to update rather than insert. What am I doing wrong? function beforeFilter() { $this->Wizard->steps = array('profile', 'merit', 'finance', 'education', 'endorsement'); } function wizard($step = null) { if(isset($this->passedArgs['1']) || $this->Session->read('application_id')) //if application already defined, load it { //Ensure the user is authorized to edit the application if(isset($this->passedArgs['1'])) {$this->Session->write('application_id', $this->passedArgs['1']);} $application = $this->Application->findById($this->Session->read('application_id')); if($application['Application']['user_id'] == $this->Auth->user('id')) { } else { $this->Session->setFlash('You do not have authorization to view this.'); $this->Session->delete('application_id'); $this->redirect('/applications'); } } else //if not entering with previously started application, start one { //create application record $this->Application->create(); $this->Application->save(array('user_id'=>$this->Auth->user('id'))); $this->Session->write('application_id', $this->Application->getInsertID()); } $this->Wizard->process($step); } function _processMerit() { App::import('Sanitize'); Sanitize::clean($this->data); switch($this->params['form']['action']) { case 'Continue': if($this->Merit->save($this->data)) { return true; } else { $this->Session->setFlash('Sorry, the information you\'ve entered is incorrect.'); return false; } break; case 'Back': $this->redirect('/applications/wizard/profile'); break; case 'Save': if($this->Merit->save($this->data)) { $this->Session->setFlash('Your changes have been saved.'); } else { $this->Session->setFlash('Sorry, the information you\'ve entered is incorrect.'); } break; } return false; } Jon Chin brian wrote:On Fri, Jun 19, 2009 at 2:04 AM, Jon Chin<j...@boogly.net> wrote:Thanks for the tip. Sadly, I'm still having problems with it. When I add <?=$form->input('id');?> to the view, all it does is generate <input type="hidden" name="data[Application][id]" value="" id="ApplicationId" /> which doesn't change anything in my controller when I print the contents of $this->data. I also tried making the field called application_id in the form, but it didn't have an effect either. It's really stumping me. Any idea what's going on? Since my primary key on Merit is application_id, should Cake already know that if I'm trying to set $this->Merit->id?The PK for Merit should be "id", not "application_id". That should be a foreign key pointing to applications table. If you post the code for the controller action we might be able to sort it out.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
smime.p7s
Description: S/MIME Cryptographic Signature