Field is Hidden after set_df_property Read Only

when I add custom script for

cur_frm.cscript.custom_refresh = function(doc) {
cur_frm.set_df_property(“naming_series”, “read_only”, cur_frm.doc.amended_from !=“”);

}

It works if the sales order is amended document, but when create new sales order, the naming_series become hidden…anyone have idea ?

Can you explain what do you want to achieve?

Hi @alan
when you create a new sales order the value of the cur_frm.doc.amended_from is equal to undefined
and actually in JavaScript undefined is not equal to empty string “” so your condition here will ends up to be true so the field naming_series will turn to read only
if you check it like this when the form islocal

if (cur_from.doc.__islocal){
   cur_frm.set_df_property(“naming_series”, “read_only”, cur_frm.doc.amended_from !=undefined);
}

it will satisfy your logic

hope that helps,

2 Likes