Hide/Disable a custom field button

I want to hide/disable a custom field button within a script

Hi ruchin78

Hiding is easy, just customize the form, select field, click on check box “Hidden”, update your window and it will be hidden.

But i’m not able to disable it, i need some help on that, how to show a field but don’t let it be modifiable?

Regards

Hi RafaAgulair,
First of all thankyou for your reply.
You didn’t understand my question well I want to do it on the basis of script.
Anyways I have already got the solution of my problem.

But for your problem the solution is:
frappe.meta.get_docfield(this.doctype, fieldname, this.frm.docname).read_only=0
and
frappe.meta.get_docfield(this.doctype, fieldname, this.frm.docname).read_only=1

It will make the field read-only true and false.
Also, you can use the following code:

cur_frm.set_df_property(“group”, “hidden”, false);

OR

cur_frm.get_field(“fields”).grid.toggle_reqd(“fieldname”, true);

Regards
Ruchin Sharma

1 Like