Skip to main content
Participant
Nov 7, 2018 9:22 PM UTC
Question

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.

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;}

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

try67
Community Expert
Community Expert
Nov 7, 2018 9:32 PM UTC

It seems fine. Have you checked the JS Console for error messages?

Translate
Participant
Nov 7, 2018 10:50 PM UTC

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

Translate
try67
Community Expert
Community Expert
Nov 7, 2018 10:53 PM UTC

One of the field names you specified is incorrect. Remember that JS is case-sensitive...

Translate