Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Add custom data attribute to Content Fragment Model field/data-type

Avatar

Level 1

Hi there,

I am looking for a way to add a custom data attribute that is rendered in the DOM.

 

I have created a custom data type for Email Addresses by overlaying /libs/settings/dam/cfm/models/formbuilderconfig.

 

I have wrote some custom JavaScript that performs validation to ensure they're entered correctly.

 

However, I want to add a custom data-attribute inside the HTML for every instance of my custom data type, so that my validator can use that data-attribute as a selector.

 

Any ideas?

 

Many Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee
2 Replies

Avatar

Correct answer by
Employee

Avatar

Level 1

Thanks for the reply,

None of those links provide the functionality I am looking for.

 

I need to add a property in CRX/DE that is reflected in the HTML to be used as a selector.