ok so I am doing a couple calculations using javascript and passing the total in a READ ONLY total field, which works fine.... example: mileage * rate = total mileage cost
I do it again, with another set of fields and again I pass the total to a read only field... which works fine...
example: service hours * hourly rate = total service cost
So at this point I have a 'total mileage cost' and a 'total service cost' numbers...(both total fields again are READ ONLY)..
I want to calculate 'total mileage cost' + 'total service cost' and output the sum number into a 'total expense' field which is READ ONLY...
If I put my javascript under a field that IS NOT read only - it grabs the numbers and populates the 'total expense' field, however if I change service hours from 2 to (any number) 3, that triggers some js which recalculates total service cost, (HERE IS THE PROBLEM), however it does not update 'total expense' ...
I want to be able to stick this code under total service cost and total mileage cost and it calculate the total expense and recalculates total expense anytime either of those values change.....
Thanks for the help in advance.
not sure if this is necessary but here is my code,
function caltotalproservicecost_onchange() {
var RateTotal = Xrm.Page.getAttribute("new_ratetotal").getValue();
var TravelTotal = Xrm.Page.getAttribute("new_totaltravel").getValue();
var TotalPS = (RateTotal + TravelTotal);
Xrm.Page.getAttribute("new_totalps").setValue(TotalPS);
}
*This post is locked for comments