Please forgive my ignorance in Java - I am attempting to create a calculated field which has a base value, then if a tickbox is checked, add X to the base rate (this needs to work for multiple checkboxes); what I have so far:
event.value = 0.07;
this needs to be additive so if (for example) tickbox 1,4,6 and 8 are ticked, all their denoted values will be added to the base rate.
tickbox 1 = 0.015
tickbox 4 = 0.05
tickbox 6 = 0.02
tickbox 8 = 0.01
textbox = 0.07+0.015+0.05+0.02+0.01
any help would be greatly appreciated!
I am not using LiveCycle Designer - are you saying that it cannot be done with normal Adobe X Pro calculated form field?
Sure, it can be done, but your code was written for an LCD form, which is why we wanted to make sure what kind of form you have.
You can use something like this as the custom calculation script of the field where you want to show the total value:
var v = 1.24; // base value
if (this.getField("tickbox 1").valueAsString!="Off") v+=0.015;
if (this.getField("tickbox 4").valueAsString!="Off") v+=0.05;
event.value = v;
Awesome, works like a bomb! thanks Try67!
The simplified field notations to calculate other fields with math formulas work fine, it is just the custom script done above that doesn't work.
You can try this: Apply the value associated with each check-box as its export value and then use the Simple Field Notation option to simply add up all of those fields, plus the base value (which you can hard-code into the formula as a number or place into a hidden field and then add that field to the sum).
Try67 with the win once again! nicely done. thanks very much for your help!