Read_only is hiding field

For some reason, the code below, is hiding “myfield” instead of setting it read only:

frappe.ui.form.on(“MyDocType”, “refresh”, function(frm) {
// use the __islocal value of doc, to check if the doc is saved or not
frm.set_df_property(“myfield”, “read_only”, 1);

Any ideas??

If field is property is read only and have no value in it, it will hidden.
if you want to display the field in anyways, you should set some default value in it.

1 Like

I Tried it and worked.

Thank you!

1 Like