After a bit more investigation, I’ve noticed that master and child field events trigger differently.
Unlike on a lull, a child field triggers on lost focus, which is much more convenient.
frappe.ui.form.on('PM Client', {
// Field events trigger on a lull in editing, hence we have to rather annoyingly use the validate event
// Be very carefull when using a field event as it can trigger multiple times during lulls in editing
validate: function(frm) {
fValidateEmail(frm);
},
});
frappe.ui.form.on("PM KPI", {
// We do not have a convenient way of applying a mask to the Goal field which is of Data fieldtype,
// hence we have to validate the string some time after it has lost focus
// Unlike for master DocTypes, child table field events trigger on lost focus
goal: function(frm,cdt,cdn) {
fValidateGoal(frm,cdt,cdn);
},
});
Is there any reason for triggering field events on a lull? Or is it so, so that any programmatic changes to the field will also trigger, not only a user editing the field? But then the same should apply to child fields?