Native XFA Absent Property Creation

Units: HPDFXFARuntime and HPDFXFA

Event access

JavaScript form nodes expose getElement(className, occurrence=0); an absent supported property is created with schema defaults, and repeated access returns the same live property handle

Direct property access, such as field.font or draw.para, creates occurrence zero when the supported child is absent

const label = xfa.form.resolveNode("main.row[1].label");
const font = label.getElement("font", 0);
font.typeface = "Helvetica";
font.size = "18pt";
font.fill.color.value = "0,128,255";
label.para.hAlign = "right";
label.border.getElement("edge", 3).thickness = "0.25pt";

The occurrence argument must be a non-negative integer within schema cardinality; requesting edge[3] creates the preceding missing edge occurrences, each with its own schema defaults

Supported creation paths

Parent classSupported children and maximum occurrences
fieldassist, bind, border, calculate, caption, desc, extras, font, format, keep, margin, para, traversal, ui, validate and value: one each; items: two
field, subform, exclGroupevent children, subject to runtime node budgets and an occurrence ceiling of 65,536
eventextras and script: one each; script cannot coexist with a different event action choice
calculateextras, message and script: one each
validateextras, message, picture and script: one each
messagetext children, subject to the runtime node budget and an occurrence ceiling of 65,536; message naming and calculation-message semantics remain separate restrictions
drawassist, border, caption, desc, extras, font, keep, margin, para, traversal, ui and value: one each
uiextras and picture: one each; one mutually exclusive widget choice as described in UI Property Overrides
passwordEdit, choiceList and checkButtonborder, extras and margin: one each
fontextras and fill: one each
parahyphenation: one
borderedge and corner: four each; extras, fill and margin: one each
captionextras, font, margin, para and value: one each
assisttoolTip: one; the toolTip child carries the schema's common id, use and usehref attribute defaults and holds its text as element content
marginextras: one
fillcolor and extras: one each; linear, pattern, radial, solid and stipple: one mutually exclusive child
textEditborder, comb, extras and margin: one each
edge and cornercolor and extras: one each

Unlisted child classes return null from getElement; invalid occurrences and conflicting fill choice children fail the event transaction

Created event handlers

Version 2.1205.6 adds native created-event dispatch: event defaults are click, refOnly and the containing object, whilst actual input, focus and lifecycle consumers merge instance overrides with the corresponding template event occurrence

Repeated event occurrences select independent activities; script attributes inherit unless overridden, an explicitly empty script stays empty, and saved Form properties remain effective after reload

Native calculation and validation scripts

Provider-disabled FormCalc events can create calculate/script and validate/script chains, assign script content and contentType, and create message/text content; actual calculation and validation use the runtime's normal edit and lifecycle processing

var c = Ref(this.parent.total.getElement("calculate", 0))
var s = Ref(c.getElement("script", 0))
s.contentType = "application/x-formcalc"
s.rawValue = "this.parent.quantity.rawValue * 2"

Created scripts survive SaveToBytes and a new runtime loading that XDP; calculations react to later edits, and validation scripts can reject an invalid edit whilst preserving the previous committed value

A rejected property request rolls back the transaction, and later native events can retry without a JavaScript bridge; JavaScript-enabled session reconstruction keeps its existing behaviour

Created automation nodes honour the same execution policies as declared nodes: disabled calculation retains values, disabled validation skips its script, and warning validation reports its message without rejecting the edit

Storing script text is distinct from dispatching a new event, and this scope does not add general event-node creation, every automation policy or complete XFA schema semantics

Native persistence and identity

Creation and subsequent writes publish actual native form-packet nodes beneath the selected repeated occurrence; the template and other occurrences retain their original values

The next event rebuilds form-only property bindings from the saved native form packet, so both direct access and SOM resolution observe the created hierarchy

Retained script-object references continue to address the native property after successful transactions and instance insertion; writing a reference after its instance is removed fails and restores the transaction

Cloning a repeated prototype also clones its form-only property structure, using schema defaults for new property attributes rather than another occurrence's overrides

Engine failures and native mutation failures restore native bytes, property nodes, datasets, script state and instance order; creation shares node, operation, depth, byte and value budgets

Effective consumers and saved PDF output

Field and rich draw consumers read created font, fill/color, paragraph and border/edge properties during actual layout and flattening; subsequent events and saved XDP reloads preserve these values

Scripted assist.toolTip creation and updates flow through the same property journal: a missing assist parent is created with its toolTip child, an explicit empty assignment keeps the element with empty text, and the tooltip survives save and reload through the instance presentation's per-widget accessibility described in Dynamic XFA Instance Presentation

A font introduced only by a sparse caller Form overlay, without a template peer and without the materialisation marker, also reaches intrinsic text measurement and split-text planning, so growable geometry reflects the overlay font whilst retaining nearest-ancestor template fallback

With THotPDF.AutoFormAppearances=True, XFA text fields generate their native appearance after the effective style is applied, including supported standard font families, point size, text colour, alignment and solid border colour and width

XFA flattening keeps its own gate: the native appearance route opens only when AutoFormAppearances is written to true, the output is PDF 2.0, or a PDF/A profile is set, so the default, which now generates appearances for directly created fields, leaves XFA output as it was

Creation and formatting consumer coverage are separate: additional value child classes and widget schemas, general schema classes, property removal/reparenting, richer widget text and Unicode appearance embedding remain active implementation targets

Related APIs

Native XFA Property DOM, XFA Property Schema Defaults, TXFAEventAction and TXFAEventBinding