With the caution that I’m a beginning Velo and JavaScript coder, here’s some code that I tested and it works. I expect that @russian-dima or one of the other experts will look at it and offer improvements and fixes ![]()
I think the various element names are self-explanatory.
$w.onReady(function () {
$w("#inputSalePrice").onChange((Event) => {
const salesPrice = Math.trunc(Number($w("#inputSalePrice").value)) ;
const stdCommission = Math.round(salesPrice * 0.06);
const ourCommission = Math.round(salesPrice * 0.03);
const savings = stdCommission - ourCommission;
$w("#inputSalePrice").value = null;
$w("#txtPrice").text = '$' + salesPrice.toLocaleString();
$w("#txtStdComm").text = '$' + stdCommission.toLocaleString();
$w("#txtOurComm").text = '$' + ourCommission.toLocaleString();
$w("#txtSavings").text = '$' + savings.toLocaleString();
})
});