Currently we do not support Designer like Fragments in Adaptive Forms. But there is a workaround with some known limitations to create a composite component (which can have multiple AF Fields/Panels) which when dropped onto an AF creates all the Fields/Panel in that Component. You can reuse the same component across multiple AFs. I am detailing out the steps for the same
- Create an AF (choose the survey Template provided OOTB). Remove all the Panels/Fields except RootPanel.
- Add the necessary Fields/Panels that you would want in your Fragment. Modify the labels, add expressions etc.
- Navigate to CRXDE and copy the Panel component(present at /libs/fd/af/components/panel) and paste it in apps/mycompositecomponent and rename it to TestComponent
- In the TestComponent node add sling:resourceSuperType property with the value /libs/fd/af/components/panel
- Delete the panel.jsp and longDescription.jsp file.
- Modify the icon.png, change the title, desc property as per your needs.
- You have now created a new CQ Component. Leave other properties as is.
- Navigate to the AF created in the 1st step (It must be present at /content/forms/af/ ). Find the rootPanel node inside the AF. Copy the items node.
- Navigate to the TestComponent. Paste the items node copied in previous step inside cq:template node. You will also find a layout node inside the cq:Template. Leave it as is
- Now create any AF or open any existing AF, you will see your TestComponent in the Sidekick.
Drop the TestComponent from the Sidekick and you will see all the Fields/Panels you created in step 2 being dropped in your AF.
I will reiterate that though this approach can be used to create reusable components like Communications Details but it is not comparable to Livecycle Fragments. The known limitations are
- You won't get the custom styling changes or scripts you have added in the AF at step 2.
- Updating the reusable component will not auto reflect the changes into the forms where it has been used.
Hope it makes sense and resolves your query.