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

How to test whether a drop down box is empty

Explorer ,
Jan 31, 2019 Jan 31, 2019

Copy link to clipboard

Copied

Good evening I am attempting to create large if-then structured built into Functions.

However, I am running into the problem of not being able to write IF-ELSE statements, when the argument is whether a drop-box is empty, or not.

Here is an example:

var dropBox = this.getField("Drop Box)";

var SourceField = this.getField("Source");

if (dropBox.valueAsString != "") {

  console.println(sourceField);

}

Even if Drop Box has no strings selected, it still won't complete the statement.

Any help would be greatly appreciated!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

651

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 , Jan 31, 2019 Jan 31, 2019

Then it should work if that value is selected... What is the outcome of running this code?

Votes

Translate

Translate
Community Expert ,
Jan 31, 2019 Jan 31, 2019

Copy link to clipboard

Copied

What's the default value of the drop-down?

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 ,
Jan 31, 2019 Jan 31, 2019

Copy link to clipboard

Copied

The drop-box has a blank entry as its default

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 ,
Jan 31, 2019 Jan 31, 2019

Copy link to clipboard

Copied

Then it should work if that value is selected... What is the outcome of running this code?

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 ,
Jan 31, 2019 Jan 31, 2019

Copy link to clipboard

Copied

LATEST

The full code is supposed to scan through 7 different drop box fields.  For every first drop box field that is empty, the "Source" variable will be put into the first available drop box field.

I want to be able to scan for which ones are empty, or not, that way nothing gets over-written in the drop box fields.

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