Copy link to clipboard
Copied
Hi everyone,
I would like your guidance, please. I have built a form that includes a Spawn pages. When the user ticks the box, the code below should run and aggregate the pages. It works fine in Acrobat Reader on Windows, but on Mac, it doesn't work (when the box is ticked, nothing happens). Any idea why? and if there is any solution please
Thanks a lot
--------------------------
var checkbox = this.getField("Reader");
if (numPages > 1) {
var confirmed = app.alert({
cMsg: "Are you sure you want to uncheck the box? This will delete your current form.",
cTitle: "Confirmation",
nIcon: 2,
nType: 2,
});
if (confirmed == 4) {
event.target.value = "";
this.deletePages(1, this.numPages - 1);} else {
event.target.value = "Yes";
}
} else {
if (event.target.value !== "Off") {
this.getTemplate("Page2").spawn(1, false, false);
this.getTemplate("Page3").spawn(2, false, false);
this.getTemplate("Page4").spawn(3, false, false);
this.getTemplate("Page5").spawn(4, false, false);
this.getTemplate("Page6").spawn(5, false, false);
}
}
Copy link to clipboard
Copied
[MOVED TO THE ACROBAT PRO DISCUSSIONS]
Copy link to clipboard
Copied
You must first ensure that Mac users open this form with Acrobat, and not with Preview (which poorly supports PDF features).
Copy link to clipboard
Copied
Thank you, @JR Boulay , but yes, the user downloaded Acrobat Reader, and it still didn't work. This is why I was wondering why.
Copy link to clipboard
Copied
There's no reason this code should work on Windows and not on a Mac. What exactly happens when they try to use it? Ask them for a full description of the issue, with full-window screenshots. My bet is they're not opening it in Adobe Reader, even if they think they are.
Copy link to clipboard
Copied
The first line is useless and this one cannot suit for a checkbox:
event.target.value = "";
It should be "Off" or "Yes".
Copy link to clipboard
Copied
In which trigger did you place this script?
However, I think you're complicating things unnecessarily and that the alert is useless: if the user deletes the pages by mistake, all he has to do is tick the checkbox again to respawn them. And as the fields are all duplicates in hidden templates, they will remain filled in and no data will be deleted.