Uploaded image for project: 'Cocoon'
  1. Cocoon
  2. COCOON-1720

Form.js overwrites the CFormsInstance attribute

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.9
    • 2.1.9, 2.2
    • Blocks: Forms
    • 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. ***

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--20051214-Form.js
          2 kB
          Jean-Baptiste Quenot

        Activity

          People

            jbq Jean-Baptiste Quenot
            jbq@anyware-tech.com Jean-Baptiste Quenot
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: