Skip to content

Instantly share code, notes, and snippets.

@rmehta
Created October 10, 2012 16:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rmehta/3866677 to your computer and use it in GitHub Desktop.
Save rmehta/3866677 to your computer and use it in GitHub Desktop.
client event trigger example
// add a trigger on field "custom_field1"
cur_frm.cscript.custom_field1 = function(doc, cdt, cdn) {
// update a new field "custom_field3"
doc.custom_field3 = flt(doc.custom_field1)*flt(doc.custom_field2)/1000;
// refresh in form
refresh_field('custom_field3');
}
// add the same trigger on "custom_field2"
cur_frm.cscript.custom_field2 = cur_frm.cscript.custom_field1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment