Copy link to clipboard
Copied
I am very new to Javascript. I am trying to get a field to display a value of one of two other fields based off of a third field results. I cannot find what is wrong with this script.
var v1 = Number(this.getField("Built on Site").value);
var v2 = Number(this.getField("BOS Total").value);
var v3 = Number(this.getField("Text10").value);
if (v1==1) {event.value = v2;}
else {event.value = v3;}
Copy link to clipboard
Copied
It seems fine. Have you checked the JS Console for error messages?
Copy link to clipboard
Copied
var v1 = Number(this.getField("Built on Site").value);
var v2 = Number(this.getField("BOS Total").value);
var v3 = Number(this.getField("Text10").value);
if (v1==1) {event.value = v2;}
else {event.value = v3;}
undefined
SyntaxError: syntax error
1:Console:Exec
undefined
TypeError: f is null
1051:byteCodeTool
TypeError: this.getField(...) is null
1:AcroForm:Install Fee Due:Calculate
SyntaxError: syntax error
1:Console:Exec
undefined
Copy link to clipboard
Copied
One of the field names you specified is incorrect. Remember that JS is case-sensitive...