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
| Index | 1-based form field index |
|---|---|
| Action | Event selector: 0 validate, 1 calculate, 2 format, or 3 keystroke |
| Value | Candidate field value supplied to event.value |
| Change | Inserted or replacement text supplied to event.change for keystroke events |
| SelStart, SelEnd | 0-based selection bounds before a keystroke event |
| Flags | Bitmask combining 1 willCommit, 2 fieldFull, 4 keyDown, 8 modifier, and 16 shift |
| RepliesJSON | JSON 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