Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.9
-
None
Description
In Form.js the function showForm() stores the form in an attribute of the viewdata (the optional JS object passed by the user) called CFormsInstance . When invoking showForm() on two different forms but with the same viewdata, Form.js overwrites the attribute in viewdata. When resuming the continuation of the first form, an error occurs because the second form is referenced in the viewdata, and of course it doesn't have the same set of widgets.
In other words: when the flow attributes are shared across multiple showForm(), Form.js overwrites the CFormsInstance attribute, which causes failure when reactivating the continuation of a previous screen.
Please see attached patch: the solution is to make a copy of the JS object.
*** There's also an improvement possible in Form.js provided in the same patch: to add a sendForm() function that does the same as showForm() except that no continuation is produced, to simplify development when no continuation is needed, and to reduce memory usage. ***
In other words: when the flow attributes are shared across multiple showForm(), Form.js overwrites the CFormsInstance attribute, which causes failure when reactivating the continuation of a previous screen.
Please see attached patch: the solution is to make a copy of the JS object.
*** There's also an improvement possible in Form.js provided in the same patch: to add a sendForm() function that does the same as showForm() except that no continuation is produced, to simplify development when no continuation is needed, and to reduce memory usage. ***