Minggu, 23 Oktober 2016

How to calculate values on the fly

Let's say there are three fields on the add/edit page: Price, Quantity and Total. To calculate total value on the fly use Javascript code (add it to the Add page: JavaScript OnLoad event or Edit page: JavaScript OnLoadevent on the Events tab).
yellowbulbNote: Change the values listed in red to match your specific needs.
var ctrlPrice = Runner.getControl(pageid, 'Price');
var ctrlQuantity = Runner.getControl(pageid, 'Quantity');
var ctrlTotal = Runner.getControl(pageid, 'Total');

function func() {
  ctrlTotal.setValue(Number(ctrlPrice.getValue()) * Number(ctrlQuantity.getValue()));
};

ctrlPrice.on('keyup', func);
ctrlQuantity.on('keyup', func);
See also

LINK : 

0 komentar:

Posting Komentar

Masukan Komentar yang sesuai jika tidak, maka akan dianggap spam.