Skip to content

Instantly share code, notes, and snippets.

@MaxMorais
Forked from rmehta/gist:3866677
Created January 10, 2013 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaxMorais/4501743 to your computer and use it in GitHub Desktop.
Save MaxMorais/4501743 to your computer and use it in GitHub Desktop.
// 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