Bug #57885

Inputs are cleared from a second form if the first form produced a vallidation error

Added by Nicholas Gray over 1 year ago.

Status:New Start date:2014-04-13
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-
Has patch:No Affected Flow version:Git master

Description

Hi,

we ran in to the following Bug:

What is needed:
-A fluid template containing 2 forms (form A and B).
-Both forms are containing values from a stored object

How to reproduce the error:
- Update one form (form A) so that it will produce a validation error

Result/Reason:
- The other form (form B) will no longer contain the filled in values from the stored object as the formfield viewhelpers search for these in last submitted input array. This array only contains the inputs of the form (form A) which produced the error and thus form B is filled in with empty values

Fix:
Quickly hacked together (please refer to the attached 3 files)...
Each form is now extended with an unique ID which is checked in the hasValidationErrors method. Thus only the fields of the form producing the error will return true and the fields of other forms are filled in as usual. The ID simply generated by counting how often the form tag was called. There is certainly a better way to handle it but that was the best I could come up with. I hope it helps

Best regards

patch.tar.gz (6.8 kB) Nicholas Gray, 2014-04-14 00:00

Also available in: Atom PDF