I have written script to popup HTML field which includes a input. But script for button(Extend) in that popup is not working.
My Script code is here:
function extend_end_date(doc) {
var d = new frappe.ui.Dialog({
title: __("Please exted a End Date"),
fields: [{ fieldtype: 'HTML', fieldname: 'new_end_date'}],
primary_action_label: __("Extend"),
primary_action: function() {
frappe.msgprint("Function is working");
frm.set_value('new_end_date', new_end_date);
d.hide();
frm.save();
}
});
var $wrapper = d.fields_dict.new_end_date.$wrapper;
var extended_date = null;
d.get_primary_btn().attr('disabled', true);
var slot_html = function(frm){
return `<input type="date"
data-name=${doc.new_end_date}
style="margin: 0 10px 10px 0; width: 150px">`;
}
$wrapper
.css('margin-bottom', 0)
.addClass('text-center')
.html(slot_html);
d.show();
}
},
});
Is My script code right?
After clicking on “Extend” Button Nothing is happening.
I checked console also but no error showed there.
And that dialog is also not hiding.
please can someone help me to solve this ?