• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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.

New Here ,
Nov 07, 2018 Nov 07, 2018

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

TOPICS
Acrobat SDK and JavaScript , Windows

Views

245

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2018 Nov 07, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 07, 2018 Nov 07, 2018

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2018 Nov 07, 2018

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines