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

Disable textfield if not empty in cq dialog

Avatar

Level 2

I want to call a JS function on load of cq dialog to validate if a field already has something, if so, disable it from edition. I have tried with validation but it is called after the users interacts with the field, I need a way to do it before, when is being loaded. It is possible?

<id
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
   fieldLabel="ID"
   validation="is_empty"
   name="./id"
   required="{Boolean}true"/>

1 Accepted Solution

Avatar

Correct answer by
Level 10

Just confirmed with our Touch UI experts - they replied:

just listen to dialog-ready event and disable, something like

$document.on('dialog-ready', function(){

//get and disable here

});

More info -- Adobe Experience Manager Help | Using Event Handlers in Adobe Experience Manager Touch UI Components

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Just confirmed with our Touch UI experts - they replied:

just listen to dialog-ready event and disable, something like

$document.on('dialog-ready', function(){

//get and disable here

});

More info -- Adobe Experience Manager Help | Using Event Handlers in Adobe Experience Manager Touch UI Components