I am having difficulties identifying empty empty fields to populate other field

Explorer ,
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;

}

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?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

97

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

I am having difficulties identifying empty empty fields to populate other field

Explorer ,
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;

}

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?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

98

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
Jul 09, 2017 0
Adobe Community Professional ,
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;

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
Reply
Loading...
Jul 09, 2017 0
Explorer ,
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?

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
Reply
Loading...
Jul 10, 2017 0
Adobe Community Professional ,
Jul 10, 2017

Copy link to clipboard

Copied

You can find the description in the Acrobat JavaScript Reference.

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
Reply
Loading...
Jul 10, 2017 1
Duquette LATEST
Explorer ,
Jul 10, 2017

Copy link to clipboard

Copied

Thank You

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
Reply
Loading...
Jul 10, 2017 0