Quantcast
Channel: Adobe Community : Unanswered Discussions - Acrobat
Viewing all articles
Browse latest Browse all 73766

Calculation Based on ComboBox Selection

$
0
0

Working on a code that will base a calculation on the selection from a combobox.  Before I go any further, I unfortunatly do not have pro so I do not have access do document level scripting.  Also, I am still a novice at javascripting.  But, what I would like to do is have a combobox (InvoiceType1) which has a couple different selections.  After the user selects an item from that combobox they input their amount in (WorkCostClaimed1).  I am trying to get that amount to transfer to different boxes based on the selection from the combobox.  So if they select from the combobox "Work Hours" then the amount from WorkCostClamed1 would be calculated in a Work Hour box(which is where I am putting this code in the custom calculation area).  Not sure if this could be done without document level scripting but I wanted to ask my code that I am trying to use, as of this moment, is as follows:

 

(function () {

var Invoice = {};

Invoice["Work Hours"] = event.value = getField("WorkCostsClaimed1").value;

Invoice["Travel Hours"] = event.value = getField("WorkCostsClaimed1").value;

Invoice["Mileage Driven"] = event.value = getField("WorkCostsClaimed1").value;

Invoice["Work Hours"] = event.value = getField("WorkCostsClaimed2").value;

Invoice["Travel Hours"] = event.value = getField("WorkCostsClaimed2").value;

Invoice["Mileage Driven"] = event.value = getField("WorkCostsClaimed2").value;

Invoice["Work Hours"] = event.value = getField("WorkCostsClaimed3").value;

Invoice["Travel Hours"] = event.value = getField("WorkCostsClaimed3").value;

Invoice["Mileage Driven"] = event.value = getField("WorkCostsClaimed3").value;

var vala = this.getField("InvoiceType1").value;

var valb = this.getField("InvoiceType2").value;

var valc = this.getField("InvoiceType3").value;

if (vala in Invoice) {

        event.value = Invoice[vala];   

}

else if (valb in Invoice) {

        event.value = Invoice[valb];

}

else if (valc in Invoice) {

        event.value = Invoice[valc];

} else {

        event.value = "No information available.";

}

})();

 

Any help would be appreciated.  Not sure if I am going down the right path with this.


Viewing all articles
Browse latest Browse all 73766

Trending Articles