Hide/unhide custom field

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 Few References:

Thanks a lot!

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");


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"



I tried to look at the code doc variable is not defined. Is doc variable automatically defined by frappe?

@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:


1 Like

I want to set up ERpnext on my clients server.can I get help from someone in the community
Plz contact 9811439639