I am looking for a solution on adding a custom mandatory field while creating an experience fragment after the template selection step(PFA screenshot). The requirement is to not allow experience fragment creation until a specific custom field is filled. Is there a way to achieve this?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @AbhishekTi4 ,
Create your custom field at the xf-page component dialog level and add below properties to that field.
cq:showOnCreate="{Boolean}true"
required="{Boolean}true"
Hope this helps!!
Hi @AbhishekTi4 ,
Create your custom field at the xf-page component dialog level and add below properties to that field.
cq:showOnCreate="{Boolean}true"
required="{Boolean}true"
Hope this helps!!
Hi @AbhishekTi4
You need to overlay OOTB, create experience fragment node and add a custom node/field.
Please make sure you also write render condition to show this custom field within specific paths/templates.
Hi @AbhishekTi4 ,
To add a mandatory custom field when creating an Experience Fragment (XF) in AEM and enforce that the fragment cannot be created until this field is filled, you need to customize the Experience Fragment creation dialog and add validation logic. Here's how you can achieve this:
Create or Modify the Experience Fragment Template:
Customize the Experience Fragment Creation Dialog:
Add a Custom Field to the Dialog:
Example structure for the custom field:
/apps
/cq
/experience-fragments
/content
/dialogs
/createFragment
/items
/content
/items
/column
/items
/customField
- jcr:primaryType: "nt:unstructured"
- sling:resourceType: "granite/ui/components/coral/foundation/form/textfield"
- fieldLabel: "Custom Field"
- name: "./customField"
- required: true
- validation: "foundation-validation"
Add Validation to the Custom Field:
Update the Experience Fragment Component Model:
Here's an example of how your custom field node might look:
/apps
/cq
/experience-fragments
/content
/dialogs
/createFragment
/items
/content
/items
/column
/items
/customField
- jcr:primaryType: "nt:unstructured"
- sling:resourceType: "granite/ui/components/coral/foundation/form/textfield"
- fieldLabel: "Custom Field"
- name: "./customField"
- required: true
- validation: "foundation-validation"
Navigate to Create an Experience Fragment:
Test Validation:
By following these steps, you can add a custom mandatory field to the Experience Fragment creation dialog in AEM, ensuring that users cannot create an Experience Fragment without filling in the specified field. This approach leverages the flexibility of Granite UI and AEM's extensible dialog system to enforce custom validation rules.
Views
Replies
Total Likes
@AbhishekTi4 Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies