This topic is locked
[SOLVED]

 Add Values On The Fly Changes PHPRunner 7.1 Ent

2/14/2014 2:18:22 AM
PHPRunner General questions
E
emorials author

I wrote a values on the fly script that I've been using for about a year. The script has worked well, and calculates the values correctly until I upgraded to PHPrunner 7.1 Ent. The DB fields are the same, same name, same functions. So my question is this: "Do I have to change the calls I am making due to the improvements in 7.1 to make this scrip work again? If so what are the new value id's that should be changed?
FYI - All the values are dependent drop-downs that calculate based of previous selections in the form. Insights are greatly appreciated.
Code:
var emp1 = Runner.getControl(pageid, 'DispositionBaseCost');

var emp2 = Runner.getControl(pageid, 'MerchandiseTotal');

var emp3 = Runner.getControl(pageid, 'EmbalmingTotal');

var emp4 = Runner.getControl(pageid, 'InternmentTotal');

var emp5 = Runner.getControl(pageid, 'PlaceofDeathTransportationCost');

var emp6 = Runner.getControl(pageid, 'PreBurialFamilyTransportationCost');

var emp7 = Runner.getControl(pageid, 'PostBurialFamilyTransportationCost');

var emp8 = Runner.getControl(pageid, 'NumberDays1');

var emp10 = Runner.getControl(pageid, 'MemorialCostPP');

var emp11 = Runner.getControl(pageid, 'TotalGuests');

var emp12 = Runner.getControl(pageid, 'DonationAmount');

var ctrlEstimatedFuneralCost = Runner.getControl(pageid, 'EstimatedFuneralCost');
function func() {

ctrlEstimatedFuneralCost.setValue(parseFloat(+emp1.getValue()) + parseFloat(+emp2.getValue()) + parseFloat(+emp3.getValue()) + parseFloat(+emp4.getValue()) + parseFloat(+emp5.getValue()) + parseFloat(+emp6.getValue()) parseFloat(+emp8.getValue()) + parseFloat(+emp7.getValue()) parseFloat(+emp8.getValue()) + parseFloat(+emp10.getValue()) * parseFloat(+emp11.getValue()) + parseFloat(+emp12.getValue()));

};
emp1.on('keyup', func);

emp2.on('keyup', func);

emp3.on('keyup', func);

emp4.on('keyup', func);

emp5.on('keyup', func);

emp6.on('keyup', func);

emp7.on('keyup', func);

emp8.on('keyup', func);

emp10.on('keyup', func);

emp11.on('keyup', func);

emp12.on('keyup', func);
document.getElementById("value_Disposition_Choice_1").className += "recommended";

document.getElementById("value_DispositionBaseCost_1").className += "recommended";

document.getElementById("value_Disposition_Vessel_1").className += "recommended";

document.getElementById("value_MerchandiseTotal_1").className += "recommended";

document.getElementById("value_Embalming_Services_1").className += "recommended";

document.getElementById("value_EmbalmingTotal_1").className += "recommended";

document.getElementById("value_Final_Internment_1").className += "recommended";

document.getElementById("value_InternmentTotal_1").className += "recommended";

document.getElementById("value_Place_of_Death_Transportation_Type_1").className += "recommended";

document.getElementById("value_PlaceofDeathTransportationCost_1").className += "recommended";

document.getElementById("value_Pre_Burial_Family_Transportation_1").className += "recommended";

document.getElementById("value_PreBurialFamilyTransportationCost_1").className += "recommended";

document.getElementById("value_NumberDays1_1").className += "recommended";

document.getElementById("value_PostBurialFamilyTransportation_1").className += "recommended";

document.getElementById("value_PostBurialFamilyTransportationCost_1").className += "recommended";

document.getElementById("value_NumberDays2_1").className += "recommended";

document.getElementById("value_Memorial_Choice_1").className += "recommended";

document.getElementById("value_Memorial_Location_1").className += "recommended";

document.getElementById("value_MemorialCostPP_1").className += "recommended";

document.getElementById("value_TotalGuests_1").className += "recommended";

document.getElementById("value_Donations_1").className += "recommended";

document.getElementById("value_DonationAmount_1").className += "recommended";

document.getElementById("value_EstimatedFuneralCost_1").className += "recommended";
End Code.

Sergey Kornilov admin 2/14/2014

The first thing that doesn't look right is the use of IDs like value_Disposition_Choice_1. Those IDs may change from page to page and we recommend to use Javascript API. addClass() function is your friend: http://xlinesoft.com/phprunner/docs/ctrl_addclass.htm
Other than that it looks good and, considering it used to work in previous versions, it should work in version 7.1 as well.