How is possible to know or get event on focus on child table

To log on change , Frappe is provide the way like this.

frappe.ui.form.on("Purchase Invoice Item", {
    expense_account(frm, cdt, cdn) {
        var d = locals[cdt][cdn];
        console.log('d', d)
    }
    }
);

any solution if we want get event just on focus on input of child table item?

Hi @treeem,

Please apply it.

frappe.ui.form.on("Purchase Invoice Item", {
    expense_account: function(frm, cdt, cdn) {
        var d = locals[cdt][cdn];
        console.log('d', d.expense_account)
    }
    }
);

Then reload and check it.

Thank You!

Thanks @NCP , But what I am trying to achieve is to detect when use focus on the input event on that the child table fields.
I found the core file is frappe.public.js.frappe.form.controls.link.js of frappe framework,

this.$input.on("focus", function () {
			setTimeout(function () {
				if (me.$input.val() && me.get_options()) {
					let doctype = me.get_options();
					let name = me.get_input_value();
					me.$link.toggle(true);
					me.$link_open.attr("href", frappe.utils.get_form_link(doctype, name));
				}

				if (!me.$input.val()) {
					me.$input.val("").trigger("input");

					// hide link arrow to doctype if none is set
					me.$link.toggle(false);
				}
			}, 500);
		});

how we could bring ,override or extend this to our custom js script?

thanks

1 Like