using "if" statement

New Here ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Hi

 

In my adobe form I have 3 text fields:

  'Dep"

  "Arr"

  "DepartureClearance"

Im trying to write a script that depending on what is in Dep and Arr it will auto populate DepartureClearnce using var 

If tried the script below but it doesnt work

 

var Departure = {
APDAK: "A1B, 124.5, SQ",
FAOR: "FAOR",
FACT: "FACT"
}
function DClearance() {
if (this.getField("Dep").value == Departure.FAOR) {
if (this.getField("Arr").value == Departure.FACT) {
this.getField("DepartureClearance").value = Departure.APDAK;
}
}
}

 

Any Suggestions?

TOPICS
Create PDFs, JavaScript, PDF forms

Views

50

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 ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Where does you use the function?

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
New Here ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

I'm using it in Adobe DC, the script is in my document JavaScripts and I call up the function in keystroke script using if (event.willCommit){ DClearance() }

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 ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Where as keystroke script?

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
New Here ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

Yes the function is called using the keystroke script, but the funtcion itself is in the document JavaScript

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 ,
Apr 21, 2021 Apr 21, 2021

Copy link to clipboard

Copied

On what field does you use the script?

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
New Here ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

The keystroke script is in the field "Arr",Ive attached some screenshots if that helpsWhatsApp Image 2021-04-22 at 15.00.24.jpegWhatsApp Image 2021-04-22 at 15.01.11.jpeg

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 ,
Apr 22, 2021 Apr 22, 2021

Copy link to clipboard

Copied

LATEST

In the field "Arr" you will get correct value with 

  event.value 

 

  this.getField("Arr").value

will give the old 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
community guidelines