Live XFA SOM Path Resolution
General execution with EnableJavaScript supplies the same live form resolver to node-level resolveNode/resolveNodes, xfa.resolveNode/xfa.resolveNodes, and FormCalc accessors
Resolution follows the current repeated occurrences immediately after instance insertion, removal or movement; successful runtime transactions persist selected field writes to their native data targets and to saved XDP
Paths and occurrences
| Path | Selection |
|---|---|
row[1].cell | The second row and its selected cell |
row[*].cell | The selected cell in every row |
$form.main.row.cell | The first row and first cell through an absolute path |
row[-1].cell | The row preceding the inferred occurrence |
row[+1].cell | The row following the inferred occurrence |
main..cell[*] | Matching sibling cells in the first descendant branch |
main.* | All direct children in document order |
main.#field[name='target'] | Fields selected by a naming property predicate |
main.#subform[*].#field | The selected field under each subform, matching class names |
main.part\.name | A JavaScript resolver path containing an escaped period in a node name |
An omitted index selects one occurrence; an absolute path uses occurrence zero, while a scoped path borrows the corresponding ancestor or container index when the structures have repeated siblings
Index inference follows corresponding hierarchy levels even when source and destination nodes have different names; class selectors borrow the corresponding class occurrence index
A singly occurring target is selected without requiring the caller's occurrence index; a missing inferred occurrence returns an empty list or null instead of silently selecting another scope
Relative indices are offsets from the unadorned inferred occurrence and are invalid in absolute paths; FormCalc index expressions can compute an occurrence at runtime
Unnamed containers are transparent to named child lookup; parent qualification and supported properties such as rawValue, name, className, index, presence and access are available, and script-object lexical exports can be resolved and assigned through FormCalc paths
Conditions
const rows = xfa.resolveNodes("main.row[*].(Number(this.cell.rawValue)>15)");
const selected = xfa.resolveNodes("main.row[*].[cell ge 20].cell");
target = Sum($.resolveNodes("row.[cell ge 20].cell"))
row[1].cell = 25
var p = Ref(row[1].cell)
p = 30
JavaScript predicates use .(expression) and execute with the candidate as this; FormCalc predicates use .[expression] and resolve relative fields against that candidate
A predicate selects matching siblings even when [*] is omitted; JavaScript predicates also resolve bare field names in the candidate scope, and predicate paths in FormCalc source must be passed as quoted resolver strings
Descendant lookup searches in document order for a branch that satisfies the remaining path components; a branch with no matching suffix does not conceal a later complete match
An occurrence index is local to its matching sibling group; an out-of-range index ends that descendant search, so main..cell[1] does not select a cell in another row when the first row has only one cell
A preceding wildcard evaluates descendant lookup independently for each selected context, and a wildcard directly after an absolute root selects the root's children
JavaScript predicates receive the current event's xfa and event objects; candidate-relative lookup, predicate exceptions and native writes share the enclosing transaction
Nested Eval inherits the predicate candidate, uses isolated calculation variables and functions, and shares native compilation responses and transactional replay with the enclosing event
Exists(missing) and an accessor to a nonexistent indexed occurrence return 0 through Exists; ordinary use of an unresolved FormCalc object raises an error
Budgets and migration
Paths permit at most 128 components and 65,536 UTF-16 code units; indices must be safe integers, and traversal, predicates, dynamic compilation and instance operations share the event execution budgets
Parser errors, predicate exceptions and exceeded budgets abort the event and restore native field values, instance order and script state through TXFAWidgetRuntime
Earlier general resolveNodes expanded omitted indices across all repeated ancestors; use main.row[*].cell[*] when every row and every cell are intended, replacing main.row.cell[*]
Coverage
The resolver operates on live form objects supplied by the event bindings, including fields, subforms, draws, exclusion groups, areas and script objects, the native Data DOM exposed through $data and $record, and declared template property nodes with effective attributes
JavaScript name escaping is supported by resolver strings; FormCalc source identifiers retain the compiler's identifier grammar
Related APIs
HPDFXFACompileFormCalcEvent, HPDFXFAExecuteJavaScriptEvent, Dynamic Eval, FormCalc References and Interactive XFA Runtime