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

SOLVED

foundation-contentloaded and dialog-ready event listers fired before touch dialog loads all content - AEM 6.4

Anderson_Hamer
Level 4
Level 4

I am doing some custom field level validation in touch UI. I can see the dialog-ready and 

foundation-contentloaded event fires before the dialog content is fully loaded which gives me empty value.
 
I would want to know, Is there any event listener that i can use for triggering a call after my dialog is fully loaded with all widgets and its values. 
 
 

 

(function(document, $) {
"use strict";

$(document).on("change", ".nutri-info-content", function(e) {
var val = $(".nutri-info-dropdown").val();  // This works 
if (val == "abc") {
$('.nutri-info-field').parent().hide();
} 

});

$(document).on("foundation-contentloaded", function(e) {
    var val = $(".nutri-info-dropdown").val(); // Value is not coming. facing same problem even with dialog-ready event. 
    if (val == "abc") {
    $('.nutri-info-field').parent().hide();
    }
});

})(document, Granite.$);

 

 
Touch UI validation
1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

The events do work, could you please share your dialog xml? 

(function(document, $) {
"use strict";
$(document).on("foundation-contentloaded", function(e) {
var item = $(".nutri-info-dropdown").val(); // Value is not coming. facing same problem even with dialog-ready event.
console.log(item);
});

$(document).on("change", ".nutri-info-dropdown", function(e) {
var item = $(".nutri-info-dropdown").val(); // This works
console.log(item);
});
})(document, Granite.$);

 

 

View solution in original post

3 Replies
KiranVedantam1992
Community Advisor
Community Advisor

Hi @Anderson_Hamer,

 

You can use dialog-ready for code to trigger once the dialog is fully loaded and dialog-closed to trigger a code once the dialog is closed.

 

Check the code in the question in the below URL:

https://stackoverflow.com/questions/49779675/dialog-ready-event-does-not-fire-when-dialog-opens-in-a...

 

Hope this helps!

 

Thanks,

Kiran Vedantam.

Anderson_Hamer
Level 4
Level 4
Kiran Vedantam, No , I tried with dialog-ready but it is not giving me the value. The variable "val" is coming as empty
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

The events do work, could you please share your dialog xml? 

(function(document, $) {
"use strict";
$(document).on("foundation-contentloaded", function(e) {
var item = $(".nutri-info-dropdown").val(); // Value is not coming. facing same problem even with dialog-ready event.
console.log(item);
});

$(document).on("change", ".nutri-info-dropdown", function(e) {
var item = $(".nutri-info-dropdown").val(); // This works
console.log(item);
});
})(document, Granite.$);

 

 

View solution in original post