Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Issue with leaving a multi-step form and coming back again #103

Open
stadelecker opened this issue Mar 6, 2023 · 0 comments
Open

Issue with leaving a multi-step form and coming back again #103

stadelecker opened this issue Mar 6, 2023 · 0 comments

Comments

@stadelecker
Copy link

If users leave a form at step 2 or higher without submitting and come back later, formhandler will prefill the form with the data from the session and show them the unsubmitted step.
The form will however not work, because the form tag is missing.
The problem originates in \Typoheads\Formhandler\View\Form::render(), Line 100ff.:

if (!$this->gp['submitted']) {
$this->storeStartEndBlock();
} elseif ((int)($this->globals->getSession()->get('currentStep')) !== 1) { 
$this->fillStartEndBlock();
}

Because the step was not submitted, the StartEndBlock will not be restored from the session.
Solution 1: Remove the "else" and make it two independent conditions (or alternatively re-order the sequence)
Solution 2: If not submitted and currentStep > 1, change currentStep = 1 before rendering

I'm currently not sure, which solution would be the better one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant