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

PDF javascript not working on Mobile - Android/ iOs

New Here ,
Aug 10, 2020 Aug 10, 2020

Hello,

I have created a dyanmic dropdown in Adobe Acrobat Pro DC. 
Dropdown selection determines the selections in another dropdown. This is working fine in desktop but when tested in mobile device - iOS/Android, nothing happens. Dropdown2 doesn't get populated.

Do you guys have any idea?

Javascript code is a simple switch statement.

 

Thanks,

EC

TOPICS
Android , iOS , PDF forms
8.5K
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
1 ACCEPTED SOLUTION
Community Expert ,
Aug 10, 2020 Aug 10, 2020

The method setItems is not available in Acrobat Reader for Android or iOS:

https://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/js.html 

View solution in original post

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 ,
Aug 10, 2020 Aug 10, 2020

How does you populate the dropdown?

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 ,
Aug 10, 2020 Aug 10, 2020

Hi Bernd,

 

I use a simple switch statement which I placed under Custom Keystroke Script.

 

 

switch (event.change) {
    
        case "SELECT YOUR CITY":
            this.getField("Street").setItems(["SELECT YOUR STREET"]);
            break;    
		case "NEW YORK":
            this.getField("Street").setItems(["SELECT YOUR STREET","STREET 1", "STREET 2"]);
            break;    
		case "CHICAGO":
            this.getField("Street").setItems(["SELECT YOUR STREET","STREET 3", "STREET 4"]);
            break;    
.
.
.
.
.
}

 

 

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 ,
Aug 10, 2020 Aug 10, 2020

The method setItems is not available in Acrobat Reader for Android or iOS:

https://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/js.html 

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 ,
Aug 10, 2020 Aug 10, 2020

Thanks for that Bernd.

 

Does that mean I should use resetForm?

this.getField("Street").resetForm(["SELECT YOUR STREET","STREET 3", "STREET 4"]);
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 ,
Aug 10, 2020 Aug 10, 2020

With resetForm you can only reset fields to default values.

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 ,
Aug 10, 2020 Aug 10, 2020

Thank you. That means no other way to achieve this in mobile devices, right?

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 ,
Aug 10, 2020 Aug 10, 2020

Do not count on any scripts working in Adobe Reader Mobile, unfortunately. Your best chance is using PDF Expert by Readdle on iOS devices.

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 ,
Aug 10, 2020 Aug 10, 2020

that's bad news. I need it to work on both iOS and Android

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

There is a "Foxit PDF reader" on android. It can read pdf with scripts

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 ,
May 11, 2021 May 11, 2021
LATEST

Foxit PDF Reader works for me , many thanks for that suggestion.

 

Have the following JS to change the colour of a field depending on the value.  Works well on PC, but won't work on in Adobe Reader on Android

 

var pres=this.getField("pressure").value;
var total=0;
var partial=0;

if (pres<101)
{
this.getField("result").value="FAIL";
this.getField("result").fillColor=color.red;
total=total+10
}
else if (pres>111)
{
this.getField("result").value="FAIL";
this.getField("result").fillColor=color.red;
total=total+10
}
else if (pres>=101 && pres<=111)
{
this.getField("result").value="PASS";
this.getField("result").fillColor=color.green;
}

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