How do I get the correct number of nodes for an object? (LiveCycle Designer)

LiveCycle Designer: I've got a form section with nine text fields, four visible. Using a loop based on number of nodes, I allow the five hidden fields to be made visible one at a time, or hidden again, one at a time, so the user can get the desired number of fields, from the minimum four up to the maximum nine. It works perfectly.

I copied the objects to a new form, changed their names, and edited the code to make sure the proper new object names were used. I deleted some text fields, so there are six maximum. I also changed things so that only one of the fields is initially visible; five are hidden. I changed the code accordingly.

For some reason, fieldName.nodes.length now reports three nodes instead of six, regardless of whether I delete or add more fields to the design. This breaks my 'add field/remove field' buttons. Any idea what's going on?


Voted Best Answer

It is entirely possible that your form hiearchy has changed. The number of nodes should always be greater than or equal to the number of objects shown on the hiearchy window in LC designer (there are sometimes non-visual objects in the hierachy). Of course you can't actually add new fields directly, only subforms can be instanciated. So the fields are added inside of subforms. Are you sure you have the code and the hiearchy setup correctly?

Another way to check this is to examine the XML source directly. Click on the node of interest in the hiearchy window and then open the XML source view tab. If this tab is not visible, you'll find it on the "View" menu in LC Designer.

There are also some wierdnesses with LC forms that may have been introduced when you copied and pasted fields. But there is no way to tell without examining the form. If this is the case then it's just better to start from scratch:(

Thom Parker
The source for PDF Scripting Info

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work

By Thom Parker   

Please specify a reason: