Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

Archive for May, 2008

Form Object Order of Initialization

Here’s a quick observation you might find useful: The order in which form objects are initialized is “field and depth-first” according to the document order (the top-down order in which they appear in the Hierarchy palette in LiveCycle Designer). This means that fields inside a subform are initialized before the subform itself is initialized. When you think about it, it makes sense since this means that in a subform’s Initialize event, you always have access to properly-initialized child form objects. You can read more about event execution order in the LiveCycle Designer Scripting Basics document (page 24) as well as in the

XFA Spec (page 353 in version 2.7).

Say your form object hierarchy looked like this (in the Hierarchy palette in Designer):

Hierarchy Order

The fields and subforms would get initialized in the following order:

Order of Initialization

To clarify, this is the order (note that text objects don’t get initialized just like squares, circles and images wouldn’t — image fields would, however):

  1. DateTimeField1
  2. TextField1
  3. PasswordField1
  4. Subform2
  5. NumericField1
  6. Subform1
  7. CheckBox1

To demonstrate this, I’ve provided the form that contains the objects above. When you preview the form (or view it in your web browser) using Acrobat, use the JavaScript Console to see the output from the Initialize events of the various form objects to see the order of initialization.

Download Sample [pdf]

Minimum Requirements: I created this form in Designer 8.1.1 SP2 and tested it in Acrobat Pro 8.1.2.

Posted by Stefan Cameron on May 9th, 2008
Filed under Events,Scripting,Tutorials