1
0
-1

Hi team,

I noticed the other day that the following scenarion doesn't work (something about the load / store binders throws an error):

  1. Form "A" has a Form Grid "FG"
  2. "FG" has multirow binders and calls Form "B"
  3. Form "B" has a Subform Repeater "SR"
  4. "SR" has multirow binders and calls Form "C"

In this scenario one cannot add an item to Form Grid "FG" - should be easy to reproduce with the scenario above.

However,

  • if I change the FG to a Subform Repeater, the form will work. 
  • if I change the SR to a Form Grid / Advanced Grid, the form will work too.

It seems like only using the combination of the two is incompatible.

Is this something that could be fixed?

Cheers,

Eric 

    CommentAdd your comment...

    3 answers

    1.  
      2
      1
      0

      Hi Eric, the team found a way to make the subform repeater to work inside the form grid. Although the storing sequence is still incorrect but it work now. You can download the new plugin from https://marketplace.joget.org/jw/web/userview/mp/mpp/_/vad?id=Subform_Repeater.

      1. Eric

        Hi Owen Ong , Great work! I will test it properly in the next couple of days. Also keen to know when the storing sequence is going to be fixed (although it doesn't cause much of a problem for me at the moment). Thanks again!

      CommentAdd your comment...
    2.  
      2
      1
      0

      Hi Eric,

      As you may notice, the Form Grid and List Grid are designed to work with simple form only. Which mean a form only have a single load and store binder at the form level. Although it does not stop you to use with a form with subform, grid inside the popup form, but the storing behavior is actually incorrect.

      Let me explain to you how Form/List Grid handle the data submission of its popup form, Form/List Grid will internally change the load and store binder of the Popup Form to an internal plugin called JsonFormBinder. The JsonFormBinder will convert the collected data to a JSON and the JSON will store to a hidden field of each row of the Form Grid. When the main form is submitted, the Form Grid element will parse the JSON of each rows and convert it to FormRowSet object to be handled by the Store binder of the Form Grid. 

      Due to the JsonFormBinder is only apply to the Form object, if the Form has other child elements (such as subform or another form grid) which have its own store binder, those store binder will be executed directly when the popup form is submitted. This also mean that all the data collected in a popup form by a sub form or grid element which has a store binder will store directly to database.

      For example:

      - Main Form has a Form Grid 1 (Mapped to Form B)
      All the data collected in Form B will only stored when Main Form is submitted. It is temporary store in hidden field of each grid row. 
      - Let said Form B in the previous example has another Form Grid 2 (Mapped to Form C)
      The data of Form C will directly store to database once Form B is submitted. But, other Form B data will still submit together with Main Form data. This behavior is incorrect as it will create dummy data in Form C table if the user end up did not submit the Main Form.

      The Subform Repeater is working another way. It actually duplicate the same form and prefixed it with row number, so everything you see in the screen will still keep there until user press submit button. All the submitted data will still handled by all the binders in the repeater form itself. 

      It is in our product roadmap to solve this complex data storing algorithm of Form Grid and List Grid.

      Best regards.

       

      1. Eric

        Hi Owen, Thanks for taking the time to explain how these things work with so much detail! I think I understand what you mean and it does explain some of the other behaviours I have seen and differences in working with the Subform Repeater and the Form Grid. Somehow I just assumed that they work in the same way (as they both resemble grid functionality). It's great to hear that solving this challenge is already on the roadmap since even though I suppose I could use Subform Repeaters, Form Grids seem much more scale-able UI wise. But am I right assuming that it also means that the Subform Repeater and Form Grid won't be compatible for quite some time? It might make sense to put a note in the knowledge base or plugin description to that effect. Thanks again - much appreciated!

      CommentAdd your comment...
    3.  
      1
      0
      -1

      Hi Owen Ong , I tested the new version of the Subform Repeater and in some scenarios it works - but not so much in others. When I run a form as part of a process or as a standalone form in the userview, everything seems to work fine (including having multiple Subform Repeaters within each other as Multirow-Binders). However, when I run the same form in a popup (in this example I used a Userview Form that opens as a popup), then the data in the Subform Repeaters is not saved (I also tried different Load / Store Binders). This is the error I get: Possible CSRF attack from url(/jw/web/json/app/ManageProjectLifecycle/1/form/options) referer(http://127.0.0.1:8080/jw/web/app/ManageProjectLifecycle/1/form/embed?_nonce=SW%25EF%25BF%25BD%2501%2522%25EF%25BF%25BD%25EF%25BF%25BD%2501_%2B&_a=submit&_callback=formgrid_ProfilesSubformWrapper_RB11BenefitProfileSubform_BenefitProfileGrid_195_add&_setting={}&_submitButtonLabel=Submit&OWASP_CSRFTOKEN=XXX-YYY-ZZZ&__a_=ManageProjectLifecycle&__u_=ProjectUserview&OWASP_CSRFTOKEN=XXX-YYY-ZZZ) IP(127.0.0.1) Any ideas on how to resolve this? Many thanks, Eric

        CommentAdd your comment...