XFA Specification
Chapter 3, Object Models in XFA
Scripting Object Model
105
<subform name="Receipt" …>
<subform name="Detail" …>
<occur min="2" max="2" />
<field name="Description" …> … </field>
<subform name="New_Subform" …>
<field name="Units" …> … </field>
<field name="Unit_Price" …> … </field>
</subform>
<field name="Sub_Total" …>
<calculate>
<script>New_Subform.Units *
New_Subform.Unit_Price</script>
</calculate>
</field>
</subform>
</subform>
</template>
</xdp>
Differences Between Qualified and Unqualified References
A SOM expression is qualified if the first character is
"$"
or
"!"
or if the first term in the expression is
xfa
.
Otherwise it is unqualified. Unqualified references search for matching nodes in the following order:
1. Children of the container
2. The container and siblings of the container
3. The parent of the container and siblings of the parent (aunts or uncles) of the container
4. The grandparent of the container and siblings of the grandparent (great-aunts or great-uncles) of the
container
5. The above steps repeat recursively up to the root. The unqualified reference fails in either of two cases.
It fails if the search reaches the root without finding a match. And it fails if it finds a match for the first
term in the expression but fails to find a match for some subsequent term.
"$." Versus Unqualified SOM Expressions
Sometimes because of name conflicts an unqualified SOM expression matches more nodes than you want,
or a different node than the one you wanted. In these cases an expression starting with
"$."
may be more
suitable. A SOM expression starting with
"$."
is syntactically a fully-qualified expression, yet it is relative
to the script container. Thus it escapes scope-matching without giving up relocation. For example, in the
following template
<xdp …>
<template>
<subform name="Receipt">
<subform name="Detail">
<validate>
<script>$.Total_Price >= 0</script>
</validate>
<field name="Total_Price"> … </field>
</subform>
Home Index Bookmark Pages
Pages: Home Index All Pages