1

while updating one of my modules for J4 i recently noticed that the repeatable subform field no longer provides the added "row" in JS. Working JS for J!3.x:

$(document).on('subform-row-add', function(event, row){ console.log(row); }

logs in J!3 something like:

<div class="subform-repeatable-group…m-repeatable-group-sr-0" data-base-name="watched" data-group="watched1" data-new="true"> ...

in J!4 it returns undefined.

I did not found any information in the web - did anyone noticed this aswell?

2
2

The way the event is invoked is slightly different for Joomla 4. You can use the following:

$(document).on('subform-row-add', function(event) {
    console.log(event.detail.row);
});

Or native ES6+ Javascript (preferred):

document.addEventListener('subform-row-add', ({ detail: { row } }) => {
    console.log(row);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.