I am trying to create a java script to auto populate a shipping rate when using Forms. I am very new to js, and just trying to improve some forms for work and make them fill-able on our website.
If its possible, and someone out in Adobeland could help write I would greatly appreciate it. What I would like is for the "Merch total" field to auto-fill my "Shipping and handling" field. Our shipping rates are as follow:
|$0.00 to $39.99||$10|
|$40.00 to $74.99|
|$75.00 to $99.99||$15|
|$100.00 to $199.99||$17|
|$200 and up||$20|
Thanks in advance!
Copy link to clipboard
You can use this code as the custom calculation script of the S&H field:
var total = Number(this.getField("Merch total").valueAsString);
if (total<40) event.value = 10;
else if (total<75) event.value = 12;
else if (total<100) event.value = 15;
else if (total<200) event.value = 17;
else event.value = 20;