Skip to main content
Participant
November 7, 2018
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.

  • November 7, 2018
  • 1 reply
  • 376 views

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 has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 7, 2018

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

Participant
November 7, 2018

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

try67
Community Expert
Community Expert
November 7, 2018

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