Expand my Community achievements bar.

Add Instance Event

Avatar

Level 2

Is there an event that I can listen for that gets fired when another instance of a repeatable field or panel is added or removed?

Haven't been able to find anything and the only thing that I've seen that works (but is very broad and catches a lot more) is the "elementVisibleChanged" event, and then I have to filter results out.

2 Replies

Avatar

Community Advisor

Hi,

I didn't get your question, if you want to listen event on multifield add/remove you can use below:

$(".coral-Button").click(function() {

            var attr = $(this).attr('coral-multifield-add');

// for remove use 'coral-Multifield-remove' class as a selector var attr = $(this).hasClass('coral-Multifield-remove');

            if (typeof attr !== typeof undefined && attr !== false) {

//your logic

     }

}



Arun Patidar

Avatar

Level 2

Thanks for the answer Arun! My question is specifically for an Adaptive Form in AEM Forms. Is that what you're targetting with your answer?

I know that I can listen to when a button was clicked, but there are other actions that might create an additional instance of a repeatable panel. I'm therefore looking to listen for an additional instance being added, rather than just a button click, which may be only one of the multiple ways that an additional instance is created.