mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
ENHANCEMENT Made MultiForm->prev() do the same behaviour for saving data as MultiForm->next()
This commit is contained in:
parent
647a5257e3
commit
a8877b780f
@ -386,16 +386,16 @@ abstract class MultiForm extends Form {
|
|||||||
* @param object $form The form that the action was called on
|
* @param object $form The form that the action was called on
|
||||||
*/
|
*/
|
||||||
public function prev($data, $form) {
|
public function prev($data, $form) {
|
||||||
if(!$this->getCurrentStep()->getPreviousStep() && !$this->getCurrentStep()->canGoBack()) {
|
// Get the previous step class
|
||||||
|
$prevStepClass = $this->getCurrentStep()->getPreviousStep();
|
||||||
|
|
||||||
|
if(!$prevStepClass && !$this->getCurrentStep()->canGoBack()) {
|
||||||
Director::redirectBack();
|
Director::redirectBack();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch the step to the previous!
|
|
||||||
$prevStepClass = $this->getCurrentStep()->getPreviousStep();
|
|
||||||
|
|
||||||
// Save the form data for the current step
|
// Save the form data for the current step
|
||||||
$this->save($data);
|
$this->save($form->getData());
|
||||||
|
|
||||||
// Get the previous step of the class instance returned from $currentStep->getPreviousStep()
|
// Get the previous step of the class instance returned from $currentStep->getPreviousStep()
|
||||||
$prevStep = DataObject::get_one($prevStepClass, "SessionID = {$this->session->ID}");
|
$prevStep = DataObject::get_one($prevStepClass, "SessionID = {$this->session->ID}");
|
||||||
|
Loading…
Reference in New Issue
Block a user