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

getField("xxxx").value returns an incorrect value from a dropdown list control, if the value "yes" is selected, the getfield("xxx").value returns "No", and vice versa. This seems to be a bug with Acrobat DC Pro....

New Here ,
Jun 20, 2016 Jun 20, 2016

A simple PDF form with multiple fields,  a validation java script to set required fields based on a value selected in a dropdown.

getField("xxxx").value returns an incorrect value from a dropdown list control, if the value "yes" is selected, the getfield("xxx").value returns "No", and vice versa. This seems to be a bug with Acrobat DC Pro....

Had to do reverse logic to get this to work, however on data extract, incorrect data value is exported

var Name = this.getField("Customer_LandLordDetails_Name");

var Street = this.getField("Customer_LandLordDetails_Street");

var Suburb = this.getField("Customer_LandLordDetails_Suburb");

var City = this.getField("Customer_LandLordDetails_City");

var Province = this.getField("Customer_LandLordDetails_Province");

var Country = this.getField("Customer_LandLordDetails_Country");

var PostalCode = this.getField("Customer_LandLordDetails_PostalCode")

var ContactName = this.getField("Customer_LandLordDetails_ContactName");

var Telephone = this.getField("Customer_LandLordDetails_Telephone");

var Email = this.getField("Customer_LandLordDetails_Email");

var Owned = this.getField("Customer_RegisteredAddress_Owned");

if (Owned.value != "Owned"){

console.println("Value = Owned " + Owned.value);

Name.required = false;

Street.required = false;

Suburb.required = false;

City.required = false;

Province.required = false;

Country.required = false;

PostalCode.required = false;

ContactName.required = false;

Telephone.required = false;

Email.required = false;

} else {

console.println("Value != Owned " + Owned.value)

Name.required = true;

Street.required = true;

Suburb.required = true;

City.required = true;

Province.required = true;

Country.required = true;

PostalCode.required = true;

ContactName.required = true;

Telephone.required = true;

Email.required = true;

}

TOPICS
Acrobat SDK and JavaScript , Windows
1.4K
Translate
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 , Jun 20, 2016 Jun 20, 2016

To access the new value of a drop-down field in its own validation script you must not use getField("...").value, but event.value.

Translate
Community Expert ,
Jun 20, 2016 Jun 20, 2016

To access the new value of a drop-down field in its own validation script you must not use getField("...").value, but event.value.

Translate
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 ,
Jun 20, 2016 Jun 20, 2016

Thanks Try67. that seemed to have worked... and changing the comparison form = to ==

Translate
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 ,
Jun 20, 2016 Jun 20, 2016

Yes, because "=" is not a comparison operator at all, it's the assignment operator...

Translate
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 ,
Jun 20, 2016 Jun 20, 2016
LATEST

thanks

Translate
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