Passing binding from the parent form to fragments

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

deepak_k_

Employee

28-08-2016

Hi,

You should put a bindRef on the Form Panel where the Fragment is associated. And for multiple use of same Fragment, this bindRef could be different.

For example, for Business Address Panel having Address fragment, if you put bindRef as /root/businessAdress & for Home Address if you use bindRef /root/homeAdress, the generated XML should be 

<root><businessAddress><Street>businessTt1</Street></businessAddress><homeAddress><Street>homeSt1</Street></homeAddress></root>

For differences b/w, 6.1 & 6.2, can you post the generated XML that was produced for 6.1 v/s 6.2?