Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

setTimeout() function not working

Avatar

Level 10

Can anyone help on the setTimeOut() function?

I'm writing the code app.setTimeOut("app.alert('hello')",2000)  which works correctly;

but the following code doesn't works..

app.setTimeOut("sayHello()",2000);

function sayHello()

{

     app.alert('hello');

}

May i know where i'm doing mistake?

Thanks,

Nith

1 Accepted Solution

Avatar

Correct answer by
Level 10

Here is a sample to help you out....

Paul

View solution in original post

4 Replies

Avatar

Level 10

Hi Nith,

The JavaScript expression in the setTimeOut() method will execution in the context of the PDF Doc object so you would need to specify the absolute reference of the sayHello function.  Something like;

app.setTimeOut("xfa.form.form1.Button1.sayHello()",2000);

You will have to work out the reference to your function in your particular case.

Regards

Bruce

Avatar

Correct answer by
Level 10

Here is a sample to help you out....

Paul

Avatar

Level 10

Thanks Bruce, I will try that and let you know the result.

Nith