Referencing object properties and values

The reference syntax you use to access or modify object properties and values takes one of the following forms:

Fully qualified
Reference syntax includes the full object hierarchy, beginning with the xfa root node. The fully qualified syntax accurately accesses the property or value of an object regardless of where the calculation or script that contains the reference syntax is located.

Abbreviated
The reference syntax is shortened either because of the relative positioning of the calculation or script that contains the reference syntax and the object syntax references, or because shortcuts are used. In general, although an abbreviated reference syntax is faster to create, the disadvantage is that it works only as long as the objects remain in the same positions relative to each other.

For example, this illustration shows the hierarchy of a sample purchase order form.

This illustration shows a fully qualified reference syntax, for both FormCalc and JavaScript, to access the value of the txtCondition field. This reference syntax could be used as part of a calculation or script on any object on the form.

View full size graphic
A.
Root Node

B.
Model

C.
Form design root node

D.
Page object

E.
Subform name

F.
Object name

G.
Property or method name

Note: Even though the reference syntax is common to both FormCalc and JavaScript, you must observe the conventions for each scripting language. For example, the reference syntax in the example above works as is for FormCalc; however, you would need to include a trailing semicolon ( ; ) character for JavaScript.

If two objects exist in the same container, such as a subform, they are referred to as sharing the same context. Where objects exist in the same context, you can use an abbreviated reference syntax that includes only the name of the object followed by the property or method you want to access. For example, using the example from above, the following abbreviated reference syntax accesses the value of the txtCondition field from any of the fields in the total subform:

txtCondition.rawValue

If two objects exist in different containers, they do not share the same context. In this case, you can use an abbreviated reference syntax; however, the syntax must begin with the name of the highest level container object that the two objects do not have in common. For example, using the hierarchy above, the following abbreviated reference syntax accesses the value of the address field from the txtCondition field:

header.address.rawValue

Due to the way the XML Form Object Model is structured, some object properties and methods exist on child objects of the objects on the form. These child objects exist only as part of the XML Form Object Model and do not appear in the Hierarchy and Data View palettes. To access these properties and methods, you must include the child objects in the reference syntax. For example, the following reference syntax sets the tool tip text for the txtCondition field:

    txtCondition.assist.toolTip.value = "Conditions of purchase."  // FormCalc 
    txtCondition.assist.toolTip.value = "Conditions of purchase."; // JavaScript

For more information about the XML Form Object model objects and their structure, see Scripting Reference .

// Ethnio survey code removed