Expand my Community achievements bar.

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
Former Community Member

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
Former Community Member

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

Avatar

Level 10

Thanks Paul, it works for me

Nith

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----