Copy link to clipboard
Copied
Hello, I am looking to calculate 5% tax on only certain field I have listed below. The script below calculates 10% and but shows as $14750.00 on a subtotal of $1475.00. Please help, what am I doing wrong.
var a = this.getField("fill_76").value;
var b = this.getField("Full Clean").value;
var c = this.getField("Floors only").value;
if (a !=="" || b !=="" || c !=="") {
event.value = a+b+c*(.05/100);
} else {
event.value ="";
}
Copy link to clipboard
Copied
The 5% calculation on the sum of the three fields should be:
(a+b+c) * .05
Copy link to clipboard
Copied
I think you totally misunderstood my directions on the radio buttons. You originally had one set of radio buttons for 4 possible answers, now you have 4 separate radio buttons. You need a Yes/No set for Youth Group and a Yes/No set for Non-Profit. The export values should be the decimals only, (i.e. .15 and .25), not Choice 1=".25". Better yet, I wouldn't even use radio buttons. I would use one check box for Youth Group and another for Non-profit. The export values will be either .15/.25 when checked, or "Off" when unchecked.
Copy link to clipboard
Copied
The script you've posted does not calculate 10% of 1450.
It add as "a", "b", and .05% of "c", i.e., that's .0005 * c
In the form the "b" and "c" values are empty strings, so the value of GST at 5% is the "subtotal", which is what's happening.
Please explain exactly how you want the calculation to work.
Copy link to clipboard
Copied
I want to calculate the 5% tax using the "Fill_76" field and the "Full Clean" field and the "Floors only" field and I want the result to show up in "Fill_81"
Copy link to clipboard
Copied
Copy link to clipboard
Copied
The 5% calculation on the sum of the three fields should be:
(a+b+c) * .05
Copy link to clipboard
Copied
Thank you, I attached the actual file and I have another question. At the top of the form there are check boxes for youth groups and non profit group. Is there a way if someone clicked the Yes box in one of these fields that the discount would automatically appear at the bottom of the form in the fields "nonprofit group 15%" or "Youth Group 25%" depending on the option they chose. How would I write this?
Copy link to clipboard
Copied
You need 2 sets of radio buttons: One for Youth and another for non-profit. Change the export values of the Yes buttons to .15 and .25 respectively, and the No buttons to zero. The text fields are shown as $ not percent. % of which field? You put a calculation in the text fields that says Value is the product of then select the 2 fields (the radio button set and the field that it is a percentage of).
Polite suggestion: You should put seperate questions in separate posts to make it easier for readers to search and find answers.
Copy link to clipboard
Copied
Where do I change the export values of the radio buttons? Thank you for the suggestion. Going forward I will.
Copy link to clipboard
Copied
It's called Radio button choice in the options tab.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You must change the fields calculation order so that fill_81 comes after fill_76 in the list.
Copy link to clipboard
Copied
I did that but it is still not working.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I think you totally misunderstood my directions on the radio buttons. You originally had one set of radio buttons for 4 possible answers, now you have 4 separate radio buttons. You need a Yes/No set for Youth Group and a Yes/No set for Non-Profit. The export values should be the decimals only, (i.e. .15 and .25), not Choice 1=".25". Better yet, I wouldn't even use radio buttons. I would use one check box for Youth Group and another for Non-profit. The export values will be either .15/.25 when checked, or "Off" when unchecked.
Copy link to clipboard
Copied
Thank you, everything is working great.