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

148

Likes

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

Adobe Community Professional , Jan 31, 2019 Jan 31, 2019
Then it should work if that value is selected... What is the outcome of running this code?

Likes

Translate

Translate
Adobe Community Professional ,
Jan 31, 2019 Jan 31, 2019

Copy link to clipboard

Copied

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

Likes

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

Likes

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
Adobe Community Professional ,
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?

Likes

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.

Likes

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