HPDFXFACompileFormCalcEvent
Unit: HPDFXFAEventScript
Declaration
function HPDFXFACompileFormCalcEvent(const Script: AnsiString;
const Limits: TXFAFormScriptLimits; out JavaScript: AnsiString;
out Diagnostic: string): Boolean;
Behaviour
Compiles supported FormCalc event syntax to JavaScript for the bounded event host without running the result
Supports variables, conditionals, loops, user functions with implicit results, arithmetic, comparison, concatenation, implicit field assignment and wildcard node aggregation
Returns True and the compiled JavaScript on success; parse errors and exceeded compiler budgets return False with a Diagnostic and no usable output
Input is UTF-8 encoded in AnsiString; run the result through HPDFXFAExecuteJavaScriptEvent or use TXFAWidgetRuntime.DispatchEvent for transactional publication
Built-in names are case-insensitive; the event host supplies the implemented FormCalc function library
Live SOM accessors support inferred, absolute, relative and computed indices, wildcard aggregation, class and descendant selectors, selected field assignment and script-object lexical properties; predicate paths use quoted resolver strings
Ref distinguishes ordinary value copies from explicit object handles; variable and function argument assignment preserves explicit handles, scalar assignment writes through a handle, and equality results use numeric 1 or 0
Eval compiles dynamically supplied calculations during general execution with independent local scope and recorded responses; compiling the outer event alone does not run or compile its dynamic source arguments
Choice item methods accept explicit Ref handles, and selectedIndex and length are recognised as field properties in SOM expressions rather than child-node selectors
Related APIs
Interactive Dynamic XFA Widget Runtime, FormCalc Functions and XFA Packet DOM