On_change event

how can we trigger on_change Event on change the link field value…

fieldtype: ‘Link’,
fieldname: “item”,
label: __(“Beginning with”),
description: __(“You can use wildcard %”),
doctype: “Item”,

"options": "Item",
"get_query": function() {
    console.log("Supplier--------------" + Supplier);
    return {

        "doctype": "Item",
        "filters": {
            "default_supplier": Supplier,
"on _change": function() {
    alert("on change");



please suggest me…


1 Like

Hi @nikhil1,

I am not sure if I understand you correctly. Typically, change triggers for form fields can be defined in the custom script of the affected doctype, simply by using the field’s name as key. Something like this

frappe.ui.form.on([DocType], {
    [trigger]: function(frm) {

For example on DocType Item, when changing description

frappe.ui.form.on("Item", {
    "description": function(frm) {
        frappe.msgprint("Changed description");

You can find more information in https://github.com/frappe/frappe/wiki/Developer-Cheatsheet#1-to-add-a-new-handler-on-value-change. Hope this helps.


hello lasalesi

Actually i want to use on_change function from UI dialogue…this is working perfectly in Script Report but not in custom Script …
after selection if i am clicking outside of field then it is working
please suggest me


frappe.ui.form.on("Doctype name", {
    onload_post_render: function(frm) {
        cur_frm.fields_dict.your_fieldname.$input.on("keypress", function(evt){
	    //Your code

Thanks for your Reply

That task has completed

thanks you

1 Like

Did the onchange event in js worked for you. I m facing the same issue. Your help will be great

You can follow this code this is working fine

frappe.ui.form.on(‘Purchase Receipt’, {
supplier: function(frm) {