Auto fill date from the date in other field

Hi Guys ,

I am trying to populate the date field based on the date in the other field but this script is not working .

frappe.ui.form.on("Machining Issue", "refresh", function(frm) { 
  frm.set_value("del_date",frappe.datetime.add_days(doc.date, 3));
});

Please help

Thanks

@Muthu,

instead of refresh trigger try to set the del_date on date fields trigger.

e.g.


frappe.ui.form.on(“Machining Issue”, “date”, function(frm) {
frm.set_value(“del_date”,frappe.datetime.add_days(doc.date, 3));
});

Thanks for the reply @makarand_b . If I try to set the date field , it automatically brings me to the desktop . It works weird , I am brought back to the desktop on clicking the date field .

Please help