XFA Specification
Chapter 3, Object Models in XFA
Scripting Object Model
85
<subform name="Detail" …>
<field name="Description" …> … </field>
<field name="Units" …> … </field>
<field name="Unit_Price" …> … </field>
<field name="Total_Price" …>
<calculate>
<script>Units *
Unit_Price</script>
</calculate>
</field>
</subform>
<field name="Sub_Total" …>
<calculate>
<script>Sum(Detail[*].Total_Price)</script>
</calculate>
</field>
<field name="Tax" …>
<calculate>
<script>Sub_Total * .08</script>
</calculate>
</field>
<field name="Total_Price" …>
<calculate>
<script>Sub_Total +
Tax</script>
</calculate>
</field>
</subform>
</template>
</xdp>
Basic Object References
XFA SOM expressions provide the means to reference objects within a DOM.
Compound Object Names
Compound object names are a way of navigating down through the hierarchy of objects; each level of the
hierarchy is represented by a name and the names are separated by dot (
"."
) characters. The simplest XFA
SOM expressions begin with the name of the root node (highest object in the hierarchy) which is named
xfa
. To reference an object within
xfa
, add a dot (
"."
) to the right of
"xfa"
and then append the name
of the node you want. Repeat to whatever depth is required.
The template is placed in the hierarchy under the node
xfa.template
. For example, in the receipt
template the Tax field is identified in SOM expressions as:
xfa.template.Receipt.Tax
The data that fills the form is placed in the hierarchy under the node
xfa.datasets.data
. For example,
using the receipt example, the node corresponding to the sub-total is identified in SOM as:
xfa.datasets.data.Receipt.Sub_Total
Home Index Bookmark Pages
Pages: Home Index All Pages