I need add a custom button in a purposes table, in maintenance visit.
Tried:
frappe.ui.form.on("Maintenance Visit", "refresh", function(frm){
$.each (frm.doc.purposes, function(i, d){
frm.doc.purposes[i].add_custom_button("Orçamento"), function(){}
});
});
Sangram
3
Add custom field in Maintenance Visit Purpose with field type Button
you can trigger it as follow,
write Custom script for form - Maintenance Visit
frappe.ui.form.on("Maintenance Visit Purpose", "orçamento", function(frm, cdt, cdn){
//Script
})
But i don’t wanna add a custom field, i wanna add the button by script.
It’s possible do this in a table?
If some condition, add button.
Sangram
7
add button through Customize Form/Custom Field. and hide/show it on condition,
e.g.
cur_frm.fields_dict['table_name'].grid.toggle_display("table_fieldname", condition);
I can not use if in this condition?
Can you give me an example?
Sangram
10
condition means here which returns true/false or 0/1.
e.g.
cur_frm.fields_dict['table_name'].grid.toggle_display("table_fieldname", frm.doc.__islocal);
But i need to use a if, cause is a select box… Depending of the string, the button will appear/hide
Sangram
12
So what is your if condition or syntax? Paste here
if (frm.doc.custom_field == “Interno”)
Sangram
14
then try this,
cur_frm.fields_dict['table_name'].grid.toggle_display("table_fieldname", frm.doc.custom_field == “Interno”);