mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
BUGFIX #4480 MultiForm::next() and MultiForm::prev() now save the form data before checking the next or previous step
This commit is contained in:
parent
cbc7d246ac
commit
794e74bebe
@ -387,6 +387,8 @@ abstract class MultiForm extends Form {
|
||||
* @param object $form The form that the action was called on
|
||||
*/
|
||||
public function next($data, $form) {
|
||||
// Save the form data for the current step
|
||||
$this->save($form->getData());
|
||||
|
||||
// Get the next step class
|
||||
$nextStepClass = $this->getCurrentStep()->getNextStep();
|
||||
@ -402,9 +404,6 @@ abstract class MultiForm extends Form {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save the form data for the current step
|
||||
$this->save($form->getData());
|
||||
|
||||
// Determine whether we can use a step already in the DB, or have to create a new one
|
||||
if(!$nextStep = DataObject::get_one($nextStepClass, "SessionID = {$this->session->ID}")) {
|
||||
$nextStep = new $nextStepClass();
|
||||
@ -431,6 +430,9 @@ abstract class MultiForm extends Form {
|
||||
* @param object $form The form that the action was called on
|
||||
*/
|
||||
public function prev($data, $form) {
|
||||
// Save the form data for the current step
|
||||
$this->save($form->getData());
|
||||
|
||||
// Get the previous step class
|
||||
$prevStepClass = $this->getCurrentStep()->getPreviousStep();
|
||||
|
||||
@ -439,9 +441,6 @@ abstract class MultiForm extends Form {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save the form data for the current step
|
||||
$this->save($form->getData());
|
||||
|
||||
// Get the previous step of the class instance returned from $currentStep->getPreviousStep()
|
||||
$prevStep = DataObject::get_one($prevStepClass, "SessionID = {$this->session->ID}");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user