ccfiel
November 22, 2015, 9:12am
1
Hello Guys,
I have created a custom field named “Occupied By” . If the Item Group is “Pads” the “Occupied By” custom field will be showed otherwise it will be hidden. I have tried to read the manual Frappe Cloud but I only see the triggering point is validate and refresh of the doctype. What about on change trigger of a specific field? Is it possible?
1 Like
ccfiel
November 22, 2015, 11:36pm
4
I have solve this problem using this javascript code
cur_frm.cscript.custom_refresh = function(doc) {
cur_frm.toggle_display("occupied_by", doc.item_group=="Pads");
}
2 Likes
anand
November 23, 2015, 6:17am
5
@ccfiel
The new way of writing this is:
frappe.ui.form.on("refresh", function(frm) {
frm.toggle_display("occupied_by", frm.doc.item_group=="Pads");
});
Edited to frm_doc.item_group=="Pads"
However, a shortcut to this is to use Depends On in the Custom/Doc Field occupied_by:
Depends on value should be: eval:doc.item_group==="Pads"
8 Likes
ccfiel
November 23, 2015, 6:20am
6
@anand
I tried to look at the code doc variable is not defined. Is doc variable automatically defined by frappe?
anand
November 23, 2015, 6:21am
7
@ccfiel sorry, fixed the error. check my previous reply again.
1 Like
The easiest way I can think of is to use depends on and enter:
eval:doc.item_group==“Pads”
1 Like
I want to set up ERpnext on my clients server.can I get help from someone in the community
Plz contact 9811439639