Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Can different data bindings be made to different instances of a fragment?

Avatar

Former Community Member

Hello all,

Within the form I am developing I am re-using the same fragment several times.  I would like make different data bindings to the fields within the separate instances of the fragment.  Naturally, when I make data bindings to the fields within the fragment file the same bindings are present to each instance of the fragment.  Is there any way I can use the same fragment but have different data bindings within each instance of the fragment?

Best wishes,

Kieran

3 Replies

Avatar

Former Community Member

Unfortunately bindings cannot be dynamic so they cannot be changed on the fly. What yo can do however is use a relative reference for your binding in the fragment then when you import the fragment in your main form you can point the parent subform of the fragment to the right parent node in the schema. This woudl allow you to reuse the binding of the fragment in different areas of the schema as long as the structure was similar in

those sections of the schema.

Make sense?

Paul

Avatar

Former Community Member

Thank you Paul,

I have not encountered relative binding.  I am fairly new to this and am just dragging and dropping schema nodes onto the relevant fields.  How can I find out about relative binding.

Thanks again,

Kieran

Avatar

Former Community Member

Relative binding simply means that the root node that holds the fragment has an absolute reference to the node that you want in your schema. Then each object below that will be relative to that root node. Typically you will see the binding expression stated as $.name of binding node. Note that there is no path pr structure. It gets this from the parent node.

Paul