Hi, I got it working after some time of debuging the component. I have changed _getExpectedStep() function a bit... see comments below what was added and why.
Now it saves data when going back on all steps !! Tomas /** * Finds the first incomplete step (i.e. step data not saved in Session). * MODIFIED by Tomas - if using save on BACK button, last step is saved as well * so this function needed to be modified to return last step as the expected one * in case that we already have all steps completed, but not submited totaly. * --> this function must return expected step for stepValidation. until this change * it was not returning anything, and back step was not valid. * * @return string $step or false if complete * @access protected */ function _getExpectedStep() { $steps_done = 0;////MODIFIED - added foreach ($this->steps as $step) { //debug($this->Session->read("$this->_sessionKey.$step")); if (!$this->Session->check("$this->_sessionKey.$step")) { $this->config('expectedStep', $step); return $step; } else { $steps_done++;//MODIFIED - added } //MODIFIED - added if(). //in case that all steps are completed => return last step as the expected one if($steps_done == sizeof($this->steps)){ return end($this->steps); } } return false; } On Jul 27, 3:49 pm, "toka...@gmail.com" <toka...@gmail.com> wrote: > Hi, anybody has tried saving data when going back in the wizard > component? > > Wizard is working nice and is keeping data when going forward. I need > to save data when clicking the back button. Anybody knows how? > > Imagine you put some data on STEP2 but you have not continued yet. you > go back to STEP1 and then to STEP2 and data from STEP2 were not saved > - naturally - you did not clicked continue to STEP3 yet. > > so ... > > I have added ONE line of code... it working ALMOST perfectly, but it > tells me not valid step ERROR in case I am returning from the LAST > step! > ......} elseif (isset($this->controller->params['form']['Previous']) && prev > > ($this->steps)) { > this->save();//MODIFIED - added ... performs save of data when going > to back-step > ...... > It only happens on last step. maybe it has something to do with array > pointers. Anybody tried that solution?? > > Thanks > Tomas > > Component:http://bakery.cakephp.org/articles/view/wizard-component-1-2-1 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---