Hello, I wanted to mark a button as disabled if another attachment field was empty but couldn’t find any posts/documentation about it other than hiding the button. Since it’s not an option to hide it for me I wanted to share my solution below.
frappe.ui.form.on("Importar Excel Clientes", {
// refresh: function(frm) {
// }
importar: function (frm) { // "importar" is the button docfield name
if (frm.doc.file) {
frm.call({
doc: frm.doc,
method: "upload_data",
freeze: true,
freeze_message: "Importando clientes...",
callback: function (r) {
{
console.log(r);
}
},
});
} else {
// warn user about mandatory attachment.
msgprint("<b>Debe incluir un archivo primero</b>");
}
},
});