Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Add custom field validation in Content Fragment Model / Content Fragment

Avatar

Avatar
Contributor
Level 3
Mayukh007
Level 3

Likes

15 likes

Total Posts

88 posts

Correct Reply

2 solutions
Top badges earned
Contributor
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile

Avatar
Contributor
Level 3
Mayukh007
Level 3

Likes

15 likes

Total Posts

88 posts

Correct Reply

2 solutions
Top badges earned
Contributor
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile
Mayukh007
Level 3

01-02-2021

Hello,

 

We have a requirement where we need to add custom field validation when creating a content fragment (CF) using a custom content fragment model (CFM).

Currently when I create a CFM, I only see some limited option like can mark field as required or specify max char limit etc. But what if i need to create a custom date field called "Age" where I can specify Regex or logic that selected date can not be in past date etc, something like that...

 

I know we can create custom data types which I can use in my CFM but I dont see option to add validations on field link Regex, compare values, compare date value with current time etc.

 

We are in AEM 6.5.5.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

612 likes

Total Posts

589 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

612 likes

Total Posts

589 posts

Correct Reply

230 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

02-02-2021

@Mayukh007,

It is possible, I have provided a solution around over a week ago, please take a look here -> https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/ootb-validation-options-fo...

}}

In short, you can use JavaScript to append the "pattern" attribute to a given HTML element, from there it will enable HTML validation for the content fragment field itself. Your client library should have a clientlib category of "dam.cfm.authoring.v2", so when you are on the cfm authoring view, your code will be run.

Answers (0)