Copy link to clipboard
Copied
I have an interactive PDF with a form field button called “Nav_Forward_Page_14” that is set to hidden. I want the button to be visible 5 seconds after the page containing the button loads; so on Page Properties (for the page with the button), I've tried adding the following Javascript on page load, with no success:
setTimeout(function() {
this.getElementById("Nav_Forward_Page_14").style.display = "inline";
}, 5000);
Thinking that I may have the function wrong, I also tried:
setTimeout(function() {
this.getElementById("Nav_Forward_Page_14").display = display.visible;
}, 5000);After more research, I've also tried:
function runImage() {
this.getField("Nav_Forward_Page_14").display = display.visible
}
run = app.setTimeout("runImage()", 5000);
Please help me correct the function necessary to show the hidden button after a delay on page load in a PDF. Thank you in advance!
1 Correct answer
The latter code will work, if you change it from setTimeout to setTimeOut ...
Copy link to clipboard
Copied
The latter code will work, if you change it from setTimeout to setTimeOut ...
Copy link to clipboard
Copied
I have a follow up question, please. Why, and what can I do (if anything) about...
Sometimes when I go to the page with a series of buttons on setTimeOut, all of the buttons appear as scripted; but sometimes, some buttons don't appear at all - like the first, second and fifth buttons only will appear. When I leave the page and return to it, maybe all of the buttons will appear, none or some . Thoughts? I can provide the code if you'd like - it does work, but not with consistency.
Thanks!
Copy link to clipboard
Copied
Yes, please provide the code.
Copy link to clipboard
Copied
Sure, please see below, (and thank you ).
Oh, and here's more info - I placed the below script on the Page Open action for this page. The Topic# buttons are set as visible. And, I added hide actions for each Topic button before the javascript on page load to hide the topics (I want to ensure that when the page is revisited it starts over blank.)
function runImage10() {
this.getField("Topic1").display = display.visible
}
run = app.setTimeOut("runImage10()", 2500);
function runImage11() {
this.getField("Topic2").display = display.visible
}
run = app.setTimeOut("runImage11()", 3800);
function runImage12() {
this.getField("Topic3").display = display.visible
}
run = app.setTimeOut("runImage12()", 6500);
function runImage13() {
this.getField("Topic4").display = display.visible
}
run = app.setTimeOut("runImage13()", 8900);
function runImage14() {
this.getField("Nav_Forward_5").display = display.visible
}
run = app.setTimeOut("runImage14()", 9000);
Copy link to clipboard
Copied
Yay! Thank you
Copy link to clipboard
Copied
Don't use the same variable ("run") for each command. Name them run1, run2, run3, etc.
Copy link to clipboard
Copied
Many thanks again!

