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

Simple code not working :p

Lea1337
Registered: Jul 14 2009
Posts: 64
Answered

I have a simple piece of code inside the 'exit'-event of a number field that I can't figure out why it's not working. The intention is that the user will enter a number inside the number field, and upon exiting the field, a subform will be repeated the number of times equivalent to the number written by the user. Here is the code:

var count = NumberOfCases.rawValue;

for (var i = 0; i < count; i++) {
xfa.form.form1.Main_subform.subform1.subform2.InstanceManager.addInstance(true);
}

I'm suspecting there is some simple thing I have overlooked :P

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
I would do it another way:

var MyCount = NumberOfCases.rawValue; xfa.form.form1.Main_subform.subform1.subform2.InstanceManager.instanceManager.setInstances(MyCount);

By the way.
You better name your variables with individual name. The name "count" is a reseved for a function in LCD, and should not be used for a variable.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Lea1337
Registered: Jul 14 2009
Posts: 64
I didn't know about the 'setInstances'-possibility, that was undeniably much easier. Thanks :-)
(and also thanks for the tip about 'count')