Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

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
Both comments and pings are currently closed.

14 Responses to “Form Object Order of Initialization”

  1. Steve Kohr on May 23rd, 2008

    Hi – I’m new to javascript and pdf forms… can this technique be used to naviagte to various locations within a pdf form in livecycle 7.1? In other words, I want users to be able to click on a link at the top of page one of a pdf from, and this action then takes the user to, say, the bottom half of page 3 of a pdf form. I don’t want them to be directed to the top of the page in question all the time, but rather to the absolute location of the content that they desire if that makes any sense.

  2. John Nesbitt on May 26th, 2008


    The trick I used was to create a TextBox, set the Appearance (Object palette -> Field tab) to None and make the caption the title of the section you want to direct the user to. Then, on the click event of your link at the top of page one, ensure the language is JavaScript then type:;

    (The somExpression property gives the fully qualified name of the object – you probably wouldn’t have to do this if you already specify the fully qualified name as the argument to setFocus).

    Hope that helps,

  3. Avijit on June 3rd, 2008

    Hi stefan,
    This is not the right topic for my question but i suppose you dont check the old topics often.
    I have a form that imports some data using Form data Integration api and then the form is passed thru Reader Extensions to make it editable.
    The problem I am facing is that when the user saves the form after typing his data the data disappears when the form is reopened.
    Kindly advise
    Thanks in advance

  4. Stefan Cameron on June 7th, 2008


    I’m not sure I follow what your form is doing. Is this an AcroForm PDF (designed in Acrobat only) or an XFA PDF form (designed in Form Designer)? What do you mean by “Form data integration API”?

  5. Avijit on June 10th, 2008

    Hi stefan,
    Yeah I designed the template in designer and I am using java APIs to import data into the form. Then i pass the form to Reader Extensions so that the form becomes editable.
    The problem is the final form does not save data that is input by the user.
    I am unable to find any reason for this behaviour.
    Kindly advise.
    Thanks in advance.

  6. Avijit on June 10th, 2008

    I have been facing another problem in the Design. I tried to use some javascript functions in my form, however they are not working.,
    When I enabled the editor in acrobat reader it gives a message that the function is not available.
    the functions I am trying to use is gotoURL() and importData().
    Kindly advise
    Thanks in advance

  7. Khoa Tran on June 13th, 2008

    Hi Stefan,

    How about ordering for the form-ready event?

    What I’m after is a field in the form that is the last one to execute the form-ready event.

  8. Stefan Cameron on June 14th, 2008


    I’m afraid I’m at a loss for suggestions. It sounds like Reader Extensions may not be configured properly for your form since it’s not enabling “local save” on the PDF (such that Reader is able to save the form).

    As for gotoURL() and importData(), you should be accessing these as “” and “” — could that be the problem?

  9. Stefan Cameron on June 14th, 2008

    Khoa Tran,

    I would guess that it’s the same order as initialization order but it’s easy to test: Just download my sample form and do the same thing I did for the Initialize events on every object’s Form:Ready event and preview the form. Then look at the output in Acrobat’s JavaScript Console.

  10. Avijit on June 16th, 2008

    HI Stefan,
    Thanks for the suggestion.
    Actually the form does get saved but without the new data that is entered.
    Infact changing the file name is also possible.
    If possible do suggest some workaround.
    Thanks in advance..

  11. Stefan Cameron on June 20th, 2008


    I really don’t know what to suggest, unfortunately, and I don’t know of any online resources, other than documentation on LiveCycle Reader-Extensions and LiveCycle Forms, where you might find the answer you’re looking for.

    Fortunately for you, when I inquired to my colleagues about your problem, they asked if they could have a look at your form to better understand what’s going on. If that’s possible, can they contact you via the email address you used when you posted your comments to my blog?

  12. Stefan Cameron on June 23rd, 2008


    It looks like there’s a forum for Reader Extensions in LiveCycle 6.x and 7.x, in case that can help, but there isn’t one for LiveCycle Reader Extensions ES.

  13. Steve Wolfel on August 20th, 2008

    Hi Stefan,

    I’ve been wrestling with this problem for a while, and thought I might seek out help from a pro. Can you programmatically control tab order through a script? I ask this because I have a form that uses a button to add a new instance, and I have set a custom tab order for the 21 fields on the form. Problem is, when I click the add button to add a new instance, the tab order reverts to its default setting. I need it to maintain the custom order when I add a new instance. Any ideas for how to handle this? Thanks for any assistance or guidance you can provide.


  14. Steve Wolfel on August 25th, 2008


    I fixed the problem without code by grouping sections within the PDF that had either western or top-down flow for data entry, and then wrapping each group in a subform. At first I tried to set each subform with a specific tab flow (western or top-down), but that didn’t work. Leaving all the subforms as positioned, however, did accomplish what I was looking to do.