[docs] custom script examples, [build] move CMS make to app via event_handlers.on_build

This commit is contained in:
Rushabh Mehta
2013-09-03 17:04:05 +05:30
parent 4263344cd2
commit d50d924ee5
12 changed files with 190 additions and 11 deletions

View File

@@ -0,0 +1,13 @@
---
{
"_label": "Make an Item read-only after Saving"
}
---
Use the method `cur_frm.set_df_property` to update the field's display.
In this script we also use the `__islocal` property of the doc to check if the document has been saved atleast once or is never saved. If `__islocal` is `1`, then the document has never been saved.
cur_frm.cscript.custom_refresh = function(doc) {
// use the __islocal value of doc, to check if the doc is saved or not
cur_frm.set_df_property("myfield", "read_only", doc.__islocal ? 0 : 1);
}