mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
commit
158f4a1bd3
@ -199,6 +199,8 @@ abstract class MultiForm extends Form {
|
||||
*/
|
||||
protected function setCurrentStep($step) {
|
||||
$this->session->CurrentStepID = $step->ID;
|
||||
$step->setForm($this);
|
||||
|
||||
return $this->session->write();
|
||||
}
|
||||
|
||||
@ -376,6 +378,12 @@ abstract class MultiForm extends Form {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!$this->getCurrentStep()->validateStep($data, $form)) {
|
||||
Session::set("FormInfo.{$form->FormName()}.data", $form->getData());
|
||||
Director::redirectBack();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save the form data for the current step
|
||||
$this->save($data);
|
||||
}
|
||||
|
@ -263,6 +263,8 @@ class MultiFormStep extends DataObject {
|
||||
$steps = DataObject::get('MultiFormStep', "\"SessionID\" = {$this->SessionID}", '"LastEdited" DESC');
|
||||
if($steps) {
|
||||
foreach($steps as $step) {
|
||||
$step->setForm($this->form);
|
||||
|
||||
if($step->getNextStep()) {
|
||||
if($step->getNextStep() == $this->class) {
|
||||
return $step->class;
|
||||
|
Loading…
Reference in New Issue
Block a user