PHORAX / formhandler

Fork of TYPO3 extension «Formhandler»
GNU General Public License v2.0
36 stars 54 forks source link

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

Open stadelecker opened 1 year ago

stadelecker commented 1 year ago

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.