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) {
|
protected function setCurrentStep($step) {
|
||||||
$this->session->CurrentStepID = $step->ID;
|
$this->session->CurrentStepID = $step->ID;
|
||||||
|
$step->setForm($this);
|
||||||
|
|
||||||
return $this->session->write();
|
return $this->session->write();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +377,13 @@ abstract class MultiForm extends Form {
|
|||||||
Director::redirectBack();
|
Director::redirectBack();
|
||||||
return false;
|
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
|
// Save the form data for the current step
|
||||||
$this->save($data);
|
$this->save($data);
|
||||||
}
|
}
|
||||||
|
@ -263,6 +263,8 @@ class MultiFormStep extends DataObject {
|
|||||||
$steps = DataObject::get('MultiFormStep', "\"SessionID\" = {$this->SessionID}", '"LastEdited" DESC');
|
$steps = DataObject::get('MultiFormStep', "\"SessionID\" = {$this->SessionID}", '"LastEdited" DESC');
|
||||||
if($steps) {
|
if($steps) {
|
||||||
foreach($steps as $step) {
|
foreach($steps as $step) {
|
||||||
|
$step->setForm($this->form);
|
||||||
|
|
||||||
if($step->getNextStep()) {
|
if($step->getNextStep()) {
|
||||||
if($step->getNextStep() == $this->class) {
|
if($step->getNextStep() == $this->class) {
|
||||||
return $step->class;
|
return $step->class;
|
||||||
|
Loading…
Reference in New Issue
Block a user