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

Extending Digital Assets with custom fields and functionality

Avatar

Former Community Member

I have a requirement to extend fields on images, and to add some custom logic, so I have created a structure shown in the image here:

[img]assetEditor.png[/img]

This works for adding extra fields, but I also need a custom logic that will look for if the main image is selected on the current image, and check current folder, and remove main image check from image that has that selected.

Is this possible to implement and how? I have tried adding listeners to asseteditor widget but statesave or beforestatesave do not work at all, meaning that it does not activate while clicking on save.

Here is the example of the asseteditor widget and the listener i have tried:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Widget" jcr:title="Image Asset Editor" sling:resourceType="cq/ui/components/widget" scene7="{Boolean}true" scene7Type="image" xtype="asseteditor"> <listeners jcr:primaryType="nt:unstructured" beforestatesave="function(field){ console.log('activate form save'); }"/> </jcr:root>
1 Accepted Solution

Avatar

Correct answer by
Level 10
1 Reply

Avatar

Correct answer by
Level 10