Problem: Copying Calculation Script from one field to another
Good Morning!
Let me preface this with up until last week i know nothing about Adobe and JavaScript.
I have a script running in my form to calulate an estimated cost based on all the selections inside the form.
The end user wants to be able to override incase of an abnormal variable. So I have a mouse up action on the field to clear the Calculation and they can manually enter an amount.
What I want is to be able to use the form reset button to add the script back.
So there are two options but i cant make either work.
Option 1:
Use the .setAction to acdd the code back hoever it is a very long string of code and im honestly not very good at this.
this.getField("Expected Cost").setAction("Calculate","SCRIPT");
How do I enter an entire string of code in that "SCRIPT" section
Option 2:
I have a hidden text box in the form that retains the Calculation Script.
When you press the reset button i need a script that will copy the Calulcation Script from "Hidden Cost" to "Expected Cost"
the Script is the below
if (this.getField("Computer").value == "Yes") {
var A = 1000
} else {
var A = 0
}
if (this.getField("Check Box2").value == "Off") {
var P = "Choose One"
} else {
var P = this.getField("Dropdown4").value};
if(P == "Desk"){
var B = 800;
} else if
(P == "Multi"){
var B = 3000;
} else if
(P == "Check"){
var B = 800;
} else if
(P == "Platform - Print Only"){
var B = 1800;
} else if
(P == "Choose One"){
var B = 0;
}
if (this.getField("Check Box3").value == "Off") {
var S = "Choose One"
} else {
var S = this.getField("Dropdown3").value};
if(S == "Adobe Standard"){
var C = 400;
} else if
(S == "Microsoft License"){
var C = 350;
} else if
(S == "Choose One"){
var C = 0;
} else if
(S == "Both"){
var C = 750;
}
if (this.getField("Check Box4").value == "Yes") {
var D = 150
} else {
var D = 0
}
if (this.getField("Check Box5").value == "Yes") {
var E = 300
} else {
var E = 0
}
if (this.getField("Check Box6").value == "Off") {
var V = "Choose One"
} else {
var V = this.getField("Dropdown10").value};
if(V == "Scanner"){
var F = 750;
} else if
(V == "Validator"){
var F = 350;
} else if
(V == "Choose One"){
var F = 0;
} else if
(V == "Both"){
var F = 1100;
}
if (this.getField("Check Box7").value == "Yes") {
var G = 350
} else {
var G = 0
}
if (this.getField("Check Box8").value == "Yes") {
var H = 300
} else {
var H = 0
}
var I = this.getField("Text12").value
event.value = A + B + C + D + E + F + G + H + I
