• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Script format

Explorer ,
Nov 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

I'm trying to create a simple script in which the selectged results in a drop-down menu field causes a specific response in another corresponding field.  The "Property" field is a drop-down menu, and the "AccountingCode" field is where I want the specific result to display.  The below script is what I entered in the AccountingCode field, but doesn't produce any result:

 

var Property = this.getField("Property").value;
if (Property=="property loss/damage") event.value = APC9AA6;
else if (Property=="real property loss/damage") event.value = APC9BB6;
else event.value = "";

 

Also, the Property drop-down field contains a blank entry (ie. 10 spaces using the space bar) to create a blank listing as the first entry on the default drop down listing. The purpose is to have the Property field default to blank to cause the employee to make a selection, rather than accidently tabbing through and using one of the pre-listed listings, which if blank, should reflect a blank in the AccountingCode field as well.

 

Any advice to assist this novice would be greatly appreciated.

TOPICS
Acrobat SDK and JavaScript

Views

327

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 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

Use this:

var Property = this.getField("Property").value;
if (Property=="property loss/damage") event.value = "APC9AA6";
else if (Property=="real property loss/damage") event.value = "APC9BB6";
else event.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
Explorer ,
Nov 27, 2020 Nov 27, 2020

Copy link to clipboard

Copied

Thank you, that worked perfect.

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 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

You have to place strings inside of quotes. Otherwise they are treated as variable names.

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 26, 2020 Nov 26, 2020

Copy link to clipboard

Copied

Another  way to do it would be when making options in dropdown field to give "property loss/damage" export value APC9AA6
and "real property loss/damage" export value APC9BB6 and then just use this code in "AccountingCode" field:
event.value = this.getField("Property").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
Explorer ,
Nov 27, 2020 Nov 27, 2020

Copy link to clipboard

Copied

LATEST

Thank you, I'll give this a shot as well.

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