ExecuteFormFieldScriptWithRepliesJSON

Form fields and JavaScript

Description

Execute an AcroForm field event script while replaying deterministic app.alert and app.response host replies from JSON

Syntax

Delphi

Function TPDFlib.ExecuteFormFieldScriptWithRepliesJSON(Index, Action: Integer; Const Value, Change: WideString; SelStart, SelEnd, Flags: Integer; Const RepliesJSON: WideString): WideString;

Parameters

Index1-based form field index
ActionEvent selector: 0 validate, 1 calculate, 2 format, or 3 keystroke
ValueCandidate field value supplied to event.value
ChangeInserted or replacement text supplied to event.change for keystroke events
SelStart, SelEnd0-based selection bounds before a keystroke event
FlagsBitmask combining 1 willCommit, 2 fieldFull, 4 keyDown, 8 modifier, and 16 shift
RepliesJSONJSON array or object containing ordered typed replies for app.alert button codes and app.response strings or null

Return values

Returns a JSON object reporting execution status, resulting value, change, rc, selection bounds, and consumed host-dialog prompts.

Remarks

Validates each scripted app.alert or app.response call against the next entry in RepliesJSON in request order without displaying UI dialogs.

Withholds document field mutations if a required reply is missing, mismatched, or left unconsumed.

See also

ExecuteFormFieldScriptJSON, SetFormScriptHostActionMode, GetFormScriptDiagnostics