Copy link to clipboard
Copied
Is there a way to write a javascript for adding the cost of items IF their checkbox is checked? I have an inventory sheet. I need to check off what items someone will be getting. But as I check each box, I need each item's cost to add up in a separate field.
You actually don't need to use any scripts for this. Just set the price as the Export Value of each check-box and then select them directly in the Sum function under the Calculate tab of the total field.
Copy link to clipboard
Copied
Yes , it is possible.
Have you tried writing your own script yet?
Copy link to clipboard
Copied
No, but only because I don't really know how. Is there like a YouTube video or something?
Copy link to clipboard
Copied
Hi dmk59,
You could put the following script in the Custom Calculation Script of the line total that refers to the relevant line checkbox, and then have a "total" at the bottom, and that sums each line that has been 'checked' - obviously the export value of the checkbox might need changing from the example below, as will the pricing and field naming;
event.value = this.getField("Checkbox1").value == 1 ? "100.00" : "";
Copy link to clipboard
Copied
Thank you for your help!
Copy link to clipboard
Copied
You actually don't need to use any scripts for this. Just set the price as the Export Value of each check-box and then select them directly in the Sum function under the Calculate tab of the total field.
Copy link to clipboard
Copied
YOU. ARE. AN. ANGEL!!! Thanks! I keep having to make these forms and I'm probably not the best condidate for it. This answer is exactly what I needed.