Passing binding from the parent form to fragments

Avatar

Avatar

roberth55706517

Avatar

roberth55706517

roberth55706517

26-08-2016

So one of the concepts that makes object oriented design and programming powerful is reusing components/objects. The idea is create it once, make it solid, then reuse it over and over again.

Where I'm at is that we have a form fragment that defines an address. The binding and name are defined in the fragment for the individual fields. The problem is that I have a form that uses this fragment over and over for different address types. The problem is that the binding and the name of the field is always the same and when one address is filled in, the value is propagated to all of the other fragments. This used to work better in 6.1 but in 6.2, all of the fragments become the same control. One way to get around this is to create a fragment for each address type but that loses all of the advantages of OOD.

Is there a way to override the binding from the parent form level so that the child fragments' binding can be changed as the form is built? This would be a great feature so that OOD can be used to make building of complex forms much easier. A programmer/designer could build a bunch of fragments that authors could use to build forms without having to define every single piece of the form.

View Entire Topic

Avatar

Avatar

saswatad1092830

Avatar

saswatad1092830

saswatad1092830

28-08-2016

Hi Robert,

In addition to what Deepak, mentioned, you can also add indices in the bindRef property of the container panel of the fragment. for example /root/Address[1], /root/Address[2] ...
 
The idea is to assign unique xpaths, in the bindRef property so that the different fields map to different subtrees of the data xml on submission.
 
Form 6.2 onwards, all fields which map to same xpaths in the submit xml are "synced" so that value entered in one field is reflected in the other in accordance with what data is submitted.