Trying to create a 2 second delay using javascript
Copy link to clipboard
Copied
Hello, Ken here from the UK
I am trying to create a two second delay in my javascript routine using this syntax which I know to be wrong:
var delay = 2000;
setTimeout(blank() {
this.getField(“blank6a”).display = display.visible
}, delay);
Could anyone provide help in how I can get a two second delay before a text (blank) is visible?
Thank you
Copy link to clipboard
Copied
Use the "app.setTimeout()" function:
You could almost use the same code you've shown in the post, except there may be an issue with "this". I usually store the current doc object in a variable that can be reached globally, just to avoid any local context issues.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Tom,
Thank you for your response. I am not a javascript coder having only used routines I have developed from Google searches. Your recommendation to use app.setTime function leaves me baffled as I am afraid as I simply cannot work out the syntax from the link you provided.
Would you kindly help me by providing me the code syntax for what I would like to achieve?
Best regards,
Ken
Copy link to clipboard
Copied
Try this:
var delay = 2000;
app.setTimeout("this.getField(\"blank6a\").display = display.visible;", delay);
Copy link to clipboard
Copied
Try67,
Thank you but this code did not work either. I do believe.however, we are near.
Best Regards,
Ken
Copy link to clipboard
Copied
Try it now:
var delay = 2000;
var to1 = app.setTimeOut("this.getField(\"blank6a\").display = display.visible;", delay);

