javascript on ipad

New Here ,
Dec 12, 2017

Copy link to clipboard

Copied

Hello,

    I have an awesome PDF Form that works perfectly on my PC. However many of the javascripts I'm using to make it so when you check a box another checks/unchecks are not working on iPad. Here are 2 samples. Anyone know how to get this working?

Example 1

if (event.target.value!="Off") this.getField("15moLoyalty").checkThisBox(0, true);

Example 2

if (event.target.value!="Off") this.getField("15moLoyalty").checkThisBox(0, false);

Here is another try I took doing it as a calculation field. This wont work on the iPad either.

Example 3

var f = this.getField("plans");

if(f.isBoxChecked(0)){

getField("15moLoyalty").checkThisBox(0,true);

getField("10moBundle").checkThisBox(0,true);

getField("10mowireless").checkThisBox(0,true);

}

else if(f.isBoxChecked(1)){

getField("15moLoyalty").checkThisBox(0,true);

getField("10moBundle").checkThisBox(0,true);

getField

("10mowireless").checkThisBox(0,true);

}

else if(f.isBoxChecked(6)){

getField("15moLoyalty").checkThisBox(0,false);

getField("10moBundle").checkThisBox(0,false);

getField

("10mowireless").checkThisBox(0,false);

}

else if(f.isBoxChecked(7)){

getField("15moLoyalty").checkThisBox(0,false);

getField("10moBundle").checkThisBox(0,false);

getField

("10mowireless").checkThisBox(0,false);

}

else {

getField("15moLoyalty").checkThisBox(0,false);

getField("10moBundle").checkThisBox(0,true);

getField

("10mowireless").checkThisBox(0,true);

}

The weird thing is I have some advanced Javascript that works for other calculations. Just can't figure this one out. Any help would be appreciated.

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

The Reader on iPad is far less capable than the desktop version. The code just isn't going to work. The "checkThisBox" method just isn't there.

See the documentation here...

JavaScript for Acrobat Reader Mobile API Reference (iOS)

TOPICS
Acrobat SDK and JavaScript

Views

641

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

javascript on ipad

New Here ,
Dec 12, 2017

Copy link to clipboard

Copied

Hello,

    I have an awesome PDF Form that works perfectly on my PC. However many of the javascripts I'm using to make it so when you check a box another checks/unchecks are not working on iPad. Here are 2 samples. Anyone know how to get this working?

Example 1

if (event.target.value!="Off") this.getField("15moLoyalty").checkThisBox(0, true);

Example 2

if (event.target.value!="Off") this.getField("15moLoyalty").checkThisBox(0, false);

Here is another try I took doing it as a calculation field. This wont work on the iPad either.

Example 3

var f = this.getField("plans");

if(f.isBoxChecked(0)){

getField("15moLoyalty").checkThisBox(0,true);

getField("10moBundle").checkThisBox(0,true);

getField("10mowireless").checkThisBox(0,true);

}

else if(f.isBoxChecked(1)){

getField("15moLoyalty").checkThisBox(0,true);

getField("10moBundle").checkThisBox(0,true);

getField

("10mowireless").checkThisBox(0,true);

}

else if(f.isBoxChecked(6)){

getField("15moLoyalty").checkThisBox(0,false);

getField("10moBundle").checkThisBox(0,false);

getField

("10mowireless").checkThisBox(0,false);

}

else if(f.isBoxChecked(7)){

getField("15moLoyalty").checkThisBox(0,false);

getField("10moBundle").checkThisBox(0,false);

getField

("10mowireless").checkThisBox(0,false);

}

else {

getField("15moLoyalty").checkThisBox(0,false);

getField("10moBundle").checkThisBox(0,true);

getField

("10mowireless").checkThisBox(0,true);

}

The weird thing is I have some advanced Javascript that works for other calculations. Just can't figure this one out. Any help would be appreciated.

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

The Reader on iPad is far less capable than the desktop version. The code just isn't going to work. The "checkThisBox" method just isn't there.

See the documentation here...

JavaScript for Acrobat Reader Mobile API Reference (iOS)

TOPICS
Acrobat SDK and JavaScript

Views

642

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
Dec 12, 2017 0
Adobe Community Professional ,
Dec 12, 2017

Copy link to clipboard

Copied

The Reader on iPad is far less capable than the desktop version. The code just isn't going to work. The "checkThisBox" method just isn't there.

See the documentation here...

JavaScript for Acrobat Reader Mobile API Reference (iOS)

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...
Dec 12, 2017 1
Most Valuable Participant ,
Dec 12, 2017

Copy link to clipboard

Copied

Instead of the unsupported checkThisBox method you can simply set the value property directly. Use "Off" to check the box off, and its export value to check it on.

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...
Dec 12, 2017 1
Adobe Community Professional ,
Dec 12, 2017

Copy link to clipboard

Copied

... except that the "exportValues" property isn't available on mobile either.

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...
Dec 12, 2017 1
Most Valuable Participant ,
Dec 13, 2017

Copy link to clipboard

Copied

True. You will need to know the export value in advance and hard-code it into 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
Reply
Loading...
Dec 13, 2017 1
Adobe Community Professional ,
Dec 13, 2017

Copy link to clipboard

Copied

The "export value" is used for setting the value of a check box widget. Once the value of each widget in the exclusionary group has been set, one only needs to test the value of the group. So if one wants to know if none of the check boxes in a group has been selected, they only need to to test for the value of "Off". Or to see if anyone has been selected the the value would be not equal to "Off".

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...
Dec 13, 2017 1
New Here ,
Dec 19, 2017

Copy link to clipboard

Copied

What about a way to hide a checkbox based on another checkbox selection? Of course, that will work on IOS.

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...
Dec 19, 2017 0
Adobe Community Professional ,
Dec 19, 2017

Copy link to clipboard

Copied

Nope. The field properties on mobile are limited to "name", "value", and "type". The "display" property isn't one of them.

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...
Dec 19, 2017 1
New Here ,
Dec 19, 2017

Copy link to clipboard

Copied

Ok so with the export value. Im pretty "copy/paste" then limited editing in coding. Could someone provide an example of how I might get that to work?

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...
Dec 19, 2017 0
Adobe Community Professional ,
Dec 19, 2017

Copy link to clipboard

Copied

Before you get too much farther... how much are you able to control how the PDF will be viewed on iOS? If you won't be in a position to instruct the recipients on how to open the PDF in the Adobe Acrobat Reader app, you really shouldn't bother with any of this.

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...
Dec 19, 2017 0
New Here ,
Dec 19, 2017

Copy link to clipboard

Copied

I can control it pretty completely, In what way would they have to load it?

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...
Dec 19, 2017 0
Adobe Community Professional ,
Dec 20, 2017

Copy link to clipboard

Copied

Ok then. Take a look at the PDF Expert app. It is able to run more JavaScript than the Adobe mobile viewers but your recipients will need to know to open the file in that app. You can't set it as the default.

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...
Dec 20, 2017 0