These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

App is undefined

oli
Registered: May 1 2011
Posts: 2

Hello all,
 
Recently, I am using the Adobe LiveCycle to create a form with a countdown. I keep receiving a error of "App is undefined" under the Log tab in report window.
 
Great if someone can give me some clue on this as my colleague has left a sample for me and it works well. I just copy his code to a new file to try to replicate the result but did not work.
 
Thanks,
Oli
 
The code is as below:
 
*************************************************
timer_test::ready:form - (JavaScript, client)
 
xfa.form.timer_test.variables.countdown.value = "90";
 
var second = 1000;
 
timer_test.page_01.timer_text.rawValue = xfa.form.timer_test.variables.countdown.value;
dummy = app.setInterval("xfa.form.timer_test.variables.timer.DoTimers()", second);
 
timer_test.#variables[0].timer - (JavaScript, client)
  
function ClockProc(nCurTime)
{
xfa.form.timer_test.variables.countdown = String(Number(xfa.form.timer_test.variables.countdown.value)-1);
if (Number(xfa.form.timer_test.variables.countdown.value) <= 0)
{
timer_test.page_01.timer_text.rawValue = "time out";
timer_test.page_01.timer_text.font.fill.color.value = "255,0,0";
}
else
{
timer_test.page_01.timer_text.rawValue = xfa.form.timer_test.variables.countdown.value;
}
}
 
function DoTimers()
{
ClockProc();
}
********************************************************

My Product Information:
LiveCycle Designer, Windows
George_Johnson
Online
Expert
Registered: Jul 6 2008
Posts: 1876
For XFA forms, use xfa.host instead of app:

dummy = xfa.host.setInterval("xfa.form.timer_test.variables.timer.DoTimers()", second);
oli
Registered: May 1 2011
Posts: 2
Thanks George,

Have tried and search the supporting doc. There is no setInterval property for the xfa.host object.

Much appreciate for your help.

The most interested thing is I actually have two files, one works (prepared by my colleague) and the other one not works. But the content inside is almost the same as what I can see from the designer view. Is there any way I can upload the file for comment?

May I missed something on the Form Properties setup.


Oli

**********************************************************

Error return as below:
Generating PDF Document...
Script failed (language is javascript; context is xfa[0].form[0].timer_test[0])
script=
xfa.form.timer_test.variables.countdown.value = "90";

var second = 1000;

timer_test.page_01.timer_text.rawValue = xfa.form.timer_test.variables.countdown.value;
//dummy = app.setInterval("xfa.form.timer_test.variables.timer.DoTimers()", second);
dummy = xfa.host.setInterval("xfa.form.timer_test.variables.timer.DoTimers()", second);
Error: Invalid property get operation; hostPseudoModel doesn't have property 'setInterval'
PDF generated successfully.

1 warnings/errors reported.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

you really have to use app.setInterval for your purpose.
To reference the function in your script object, you have to give the whole expression of your script object to the setInterval function.
In XFA forms, it's a more verbose than in AcroForms.
It always starts with this.xfa.form followed by the names of the nodes top down in your forms hierarchy.

  1. var second = 1000;
  2. app.setInterval('this.xfa.form.form1.timer_test.variables.timer.DoTimers();', second);

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs