Hey,
The JS API works like a charm, except 2 methods : removeComplexFieldGroup and addComplexFieldGroup.
Here is a very simple example, to illustrate :
(function($) {
$(document).on('carbonFields.apiLoaded', function(e, api) {
console.log('fooooo!'); // Is triggered.
$(document).on('carbonFields.removeComplexFieldGroup', function(e, fieldName, groupIndex) {
console.log('babar'); // Doesn't work, never triggered :/
});
$(document).on('carbonFields.fieldUpdated', function(e, fieldName) {
console.log('baaaar'); // Works fine !
});
});
})(jQuery);
Do you know why? Thanks a lot. Have a great day!
(and if you were wondering, I'm using complex fields of course : http://d.pr/i/yfbxYY).
Hi @kaleidoscopique ,
addComplexFieldGroup() and removeComplexFieldGroup() are utility methods of the API object - not events. Currently the API only provides the 'carbonFields.apiLoaded', 'carbonFields.fieldUpdated' and 'carbonFields.validateField' events.
(I added a note to our internal todo to list these events with a proper description in the docs)
Ups, okay ! It's clear for me now, thanks a lot.
Sorry to have bothered you. Have a great day Atanas! :1st_place_medal: