Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 2 Current »


You can use a new JSON entry point called onEditJSON on the onEdit event of a record. The onEditJSON function validates a value or formula as follows:

  • If the result is True, then the record enters edit mode and you can edit the record.
  • If the result is False, then the record does not enter edit mode and you cannot edit the record.


The onEditJSON function in the following example code disables edit when the account type is equal to HMO.

<html><head><title>onEdit example</title><script type="text/javascript"> 
/** disable edit if accounttype = HMO **/
function onEditJSON() {
return "[{\"action\":\"select\",\"invoke\":\"checkCondition\",\"parameters\":[{\"modulefields\":[{ \"module\":\"1\", \"fields\":\"ACCTKW01\"}],\"filter\":\"1.uid=$1.uid\"}]}]";
} 

function checkCondition(row) {
var result; 
result = "true";
if(row. length>0){ 
if(row[0]._1.ACCTKW01 == "HMO") {
window.location = "melt://showAlert/No Edit Allowed"; 
result = "false";
}
}
return "[ {\"action\":\"validate\",\"result\":\"" + result + "\"} ]";
}
</script></head><body></Body></html> 




  • No labels