Copy link to clipboard
Copied
Hello,
I need help creating a Java script when using checkbox
for example
when "CB1" is checked I need "LST" to = $600
when "CB2" is checked I need "LST" to = $750
when "CB3" is checked I need "LST" to = $800
when "CB4" is checked I need "LST" to = $900
when "CB5" is checked I need "LST" to = $1100
Thanks
Copy link to clipboard
Copied
in the future, to find the best place to post your message, use the list here, https://community.adobe.com/
p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.
<"moved from using the community">
Copy link to clipboard
Copied
What should happen if multiple checkboxes are checked, do you want to sum the result in that case?
If you don't want to sum the result, which checkbox should take precedence?
Copy link to clipboard
Copied
Good question....
this is for an order form and in theory only 1 box would need to be checked as the quanity/price gradually increases in each checked box option.
Copy link to clipboard
Copied
You can use this in a text field where you want to show price as 'Custom calculation script':
var price = [600, 750, 800, 900, 1100];
for(var i=1; i<=5; i++){
var cb = this.getField("CB"+i).valueAsString;
if(cb !== "Off"){
event.value = price[i-1];
break;}
else
event.value = "";}
Although this should work for you, if only one checkbox should be checked at a time, consider using solution posted by try67.
Copy link to clipboard
Copied
This worked!
still finalizing this order form, so I may try formula suggested by try67....I'll see how it evolves. Thanks so much!
Copy link to clipboard
Copied
Can I ask another question....is there a way to create a formula to generate a specific tax rate based on the location the item is shipping to?
Copy link to clipboard
Copied
Yes, but if you want us to help, you will have to give us more details.
Copy link to clipboard
Copied
Great
let me try to make sense when I explain it 😂
I have a basic order form that tally's in SUBTOTAL box. I manually enter a percentace in the TAX box and it multiplies SUBTOTAL box by the TAX percentage. That result ends up in the TOTAL TAX box. The SUBTOTAL and TOTAL TAX are then. Added. The result ends up in the TOTAL box.
I will have customers all over the United States with different tax rates.
Can the Tax percentage auto populate based on the shipping location.
i hope this makes sense
thanks
Copy link to clipboard
Copied
How do you choose shipping locations?
If you use the dropdown field to select shipping location, you could enter tax rate as export value for that state and then make it populate "TAX" field.
Copy link to clipboard
Copied
I am clearly a novice here. How do I create a drop down field for the shipping location?
Copy link to clipboard
Copied
If you only want one value to be selectable out of the group then give all fields the same name (for example, "CB"), but unique export values (the value should be just a number, without the dollar symbol).
Then you could use a simple script for populating the selected value into a text field:
var cb = this.getField("CB").valueAsString;
if (cb!="Off") event.value = cb;
else event.value = "";
Copy link to clipboard
Copied
Thank you!