I have a series of check boxes, 5 of them to be specific. I then have a radio button for member or non member and one more check box for additional service fee. I then have a total text box.
What I would like to do is have the script calculate the total off of the radio button value they are set to 110 and 130. then multiply the number of check boxes checked by 50$ and add the additional service fee to the total if checked. I would like this amount to show up in the Total value text box.
I am not sure how to do the radio buttons. would I do 2 if statements? one for if(this.getField("Naturalist_Membership").value == "110" then ... and one for if (this.getField("Naturalist_Membership").value == "130" then ...?
JavaScriptAdobe Acrobat
Last Comment
lsctech
8/22/2022 - Mon
Karl Heinz Kremer
I would use the following as the calculation script for the result text box:
// Count the checked check boxes
var CB_Count = 0;
var baseName = "CB.";
for (var i=0; i<5; i++)
{
if (this.getField(baseName + i).value == "Yes")
CB_Count++;
}
// get the fee
var fee = this.getField("Naturalist_Membership").value;
// store the result in this text box
event.value = (CB_Count * 50) + fee;
lsctech
ASKER
Here is my exact code. I will also attach my PDF version. I can not get it to display any text in the textbox. Please help! Thanks.
// Count the checked check boxes
var CB_Count = 0;
var baseName = "yn_";
for (var i=0; i<9; i++)
{
if (this.getField(baseName + i).value == "Yes")
CB_Count++;
}
// get the fee
var fee = this.getField("Naturalist_Membership").value;
var extra_fee
if (this.getField("yn_extended").value == "Yes")
extra_fee = 25;
// Count the checked check boxes
var CB_Count = 0;
var baseName = "CB.";
for (var i=0; i<5; i++)
{
if (this.getField(baseName + i).value == "Yes")
CB_Count++;
}
// get the fee
var fee = this.getField("Naturalist_
// store the result in this text box
event.value = (CB_Count * 50) + fee;