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

if else statement questions

New Here ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

I setting up a pdf using DC Pro.

I have a drop down box “A” with a list of DODAACs alphanumeric box and if you select a DODAAC the text box “B” will reflect the corresponding Unit Name of that DODAAC. I have this script but I have over 30 DODAAC and units and I keep getting an error “SyntaxError missing ) after condition 21:at line 22”

All lines are exactly the same format, only difference is the DODAAC and Unit Name.

if (event.value=="W90WQ1") this.getField("Unit") .value = "7th MSC"; 

else if (event.value=="W90Z6S") this.getField("Unit").value = "361ST CA BDE"; 

else if (event.value=="W58193") this.getField("Unit").value = "457TH CA BN";

else if (event.value=="W9111P") this.getField("Unit").value = "457TH A / CO";

else if (event.value=="W9111L") this.getField("Unit").value = "457TH B / CO";

else if (event.value=="W9113R") this.getField("Unit").value = "457TH C / CO";

else if (event.value=="W91Z4A") this.getField("Unit").value = "457TH D / CO";

else if (event.value=="W90WQ4") this.getField("Unit").value = "773RD CST";

else if (event.value=="W50NKZ") this.getField("Unit").value = "510th RSG";

else if (event.value=="W50NL2") this.getField("Unit").value = "83rd CSSB";

else if (event.value=="W58D6J") this.getField("Unit").value = "446TH TRANS BN";

else if (event.value==" W50NL8") this.getField("Unit").value = " 530th TRANS DET";

else if (event.value=="W50NL8") this.getField("Unit").value = "603th TRANS DET";

else if (event.value=="W50NLB") this.getField("Unit").value = "793RD  TRANS DET";

else if (event.value==" W81NHT") this.getField("Unit").value = "1177TH TRANS DET";

else if (event.value=="W811FM") this.getField("Unit").value = "341ST TRANS DET";

else if (event.value=="W58D6H") this.getField("Unit").value = "1172ND  TRANS DET";

else if (event.value=="W50NL5") this.getField("Unit").value = "MSU-E";

else if (event.value=="W813U4") this.getField("Unit").value = "7TH ILE";

else if (event.value=="WK4TUP") this.getField("Unit").value = "209TH DLD";

else if (event.value== W912FA") this.getField("Unit").value = "2500TH DLD";

else if (event.value=="W90CS4") this.getField("Unit").value = "88TH CHAP DET";

else if (event.value=="W90CS7") this.getField("Unit").value = "89TH CHAP DET";

else this.getField("Unit").value = " ";

TOPICS
Acrobat SDK and JavaScript

Views

548

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

correct answers 1 Correct answer

Community Expert , Jul 26, 2019 Jul 26, 2019

There is a missing ":

else if (event.value== W912FA") this.getField("Unit").value = "2500TH DLD";

Votes

Translate

Translate
Community Expert ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

You missing a quotation mark just before W912FA... Also, you have an extra space just before W81NHT, which will cause it not to work (if that space is not actually a part of that value).

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 ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

There is a missing ":

else if (event.value== W912FA") this.getField("Unit").value = "2500TH DLD";

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 ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

LATEST

Ok, How do I copy the text from one box to another if another box is filled.

Meaning: If drop down box A is "W90WQ1" I want box b1.c1.d1. & e1 to show the same only if box b, c, d, or e is filled?

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 ,
Jul 26, 2019 Jul 26, 2019

Copy link to clipboard

Copied

Danke,

It worked great.

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