silverstripe/silverstripe-userforms

Bug - Unable to move to previous form step if there is more than one hidden page between current and previous steps

kevin-hine-innis opened this issue · 1 comments

The issue occurs in the UserForm.js UserForm.prototype.jumpToStep function.
The jumpToStep direction parameter defaults to true, so when recursively calling jumpToStep we need to ensure we are passing direction.
If the direction is false (i.e. jump to previous step), the code will only ever go back one step.
If there are 2 or more hidden steps between the current step and the previous step, it will go back one step, see a second hidden step, then go forward one step because direction is now true.

To fix this, "direction" needs to be passed to the recursive jumpToStep call in UserForm.prototype.jumpToStep.
e.g.

      if (forward) {
        this.jumpToStep(stepNumber + 1, direction);
      } else {
        this.jumpToStep(stepNumber - 1, direction);
      }

ACs

  • Jump to step buttons work when hidden steps are present
  • Behat test next-form-step.feature is updated

PR

PR is merged. Closing this issue.