• 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 having difficulties identifying empty empty fields to populate other field

Explorer ,
Jul 09, 2017 Jul 09, 2017

Copy link to clipboard

Copied

I am using JavaScript to Identify whether or not a field is filled or empty. Depending on the results, It will assign variable to fill in the rest of the form. I cant seem to figure out what I am doing wrong. I have tried .isNull , .rawvalue, etc..... Any help would be appreciated.

This is what I have so far.

// Automatically Populates the Team Technician to the rest of the document once the field is populated on the Mileage Sheet and sets variables to predefined values;

var team = this.getField("Team").value;
var lead1 = this.getField("Lead1").value;
var team1 = this.getField("Team1").value;


event.value = "";

if ((team.value !== null || team.value !== "")&&(lead1.value==null || lead1.value=="")){

               event.value=team;

}

else if ((team.value == null || team.value == "")&&(lead1.value!==null || lead1.value!=="")){

                event.value=lead1;


}

else if ((team.value == !null || team.value !== "")&&(lead1.value!==null || lead1.value!=="")){

                event.value=team;

}

TOPICS
Acrobat SDK and JavaScript , Windows

Views

293

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

Explorer , Jul 10, 2017 Jul 10, 2017

Thank You for the suggestion Bernd, although it did not work, it did give me an idea. I assigned the variables:

var team = this.getField("Team").valueAsString;

It works as I hoped but have no idea why - can anyone explain this or point me in the direction where I can understand it better?

Votes

Translate

Translate
Community Expert ,
Jul 09, 2017 Jul 09, 2017

Copy link to clipboard

Copied

Look in the console for errors.

You don't use the values of the fields:

event.value = team;

You must use:

event.value = team.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 ,
Jul 10, 2017 Jul 10, 2017

Copy link to clipboard

Copied

Thank You for the suggestion Bernd, although it did not work, it did give me an idea. I assigned the variables:

var team = this.getField("Team").valueAsString;

It works as I hoped but have no idea why - can anyone explain this or point me in the direction where I can understand it better?

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 10, 2017 Jul 10, 2017

Copy link to clipboard

Copied

You can find the description in the Acrobat JavaScript Reference.

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 ,
Jul 10, 2017 Jul 10, 2017

Copy link to clipboard

Copied

LATEST

Thank You

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