Run when add row on child_table

Im trying to run something when I click on add row button on a child_table.
Doctype: Maintenance Visit
Child_table: purposes
child_table_field: idx
Script:

frappe.ui.form.on("purposes", {
	idx_add: function(frm){console.log("works!")}
});
1 Like

Did u try before_purposes_add event?

That’s worked:

frappe.ui.form.on('Maintenance Visit Purpose', 'purposes_add', function(frm){
	console.log('worked');
});
1 Like