...
Code Block |
---|
<html><head><title>onCreateJSON Example</title><script type="text/javascript"> /** sample script to warn if creating address under Account **/ function onCreateJSON(){ return "[{\"action\":\"select\",\"invoke\":\"getParent\",\"parameters\":[{\"modulefields\":[{ \"module\":\"1\", \"fields\":\"uid\"}],\"filter\":\"1.uid=$parent.uid\"}]}]"; } function getParent(row){ if(row.length>0) { /** it means that we are creating address under Account parent**/ return "[{\"action\":\"showprompt\",\"invoke\":\"callbackWithButtonTitle\",\"title\"\"$confirm.address.create\",\"otherbuttontitles\":[\"create\"],\"cancelbuttontitle\":\"cancel\" }]"; }else { return "[ {\"action\":\"validate\",\"result\":\"true\"} ]"; } } function callbackWithButtonTitle(otherbuttontitle1) { if(otherbuttontitle1 == "create"){ return "[ {\"action\":\"validate\",\"result\":\"true\"} ]"; }else { return "[ {\"action\":\"validate\",\"result\":\"false\"} ]"; } } function onErrorInvoke(rows){ if(rows.length > 0){ window.location = "melt://showAlert:/" + message; } } </script></head><body></Body><body></html> |
Please see the section JSON Showprompt Action for more information about prompting.