ExecuteFormFieldScript

Forms, JavaScript safety

Description

Executes the selected field action through the bounded event runtime using a value-only compatibility wrapper The supported subset includes the form helper actions emitted by the formatting, range-validation and simple-calculation APIs, plus assignments to

event.value and event.rc using arithmetic, comparisons, Boolean operators, conditionals, controlled Event, Field and Document properties, numeric conversions and common Math functions

Syntax

Function TPDFlib.ExecuteFormFieldScript(Index: Integer; Action: TPDFlibFormScriptAction; Const InputValue: WideString; Out OutputValue: WideString): Integer;

Parameters

IndexThe one-based form-field index
ActionThe validation, calculation, formatting or keystroke action to execute
InputValueThe initial value exposed as event.value
OutputValueThe final value after successful execution

Return values

Returns 1 when the action executes and accepts the value, or 0 when the action is absent, rejects the event, is unsupported, is invalid or exceeds a configured resource limit Rejected validation leaves

LastErrorCode at zero; unsupported, invalid and over-budget scripts report codes 706, 708 and 709

Remarks

A successful calculation action writes its result to the field, while validation and formatting return their result without changing the stored field value Unsupported statements such as

app.alert, dynamic code, global access and external I/O are never invoked Use

ExecuteFormFieldScriptEvent when keystroke changes, selection state, key modifiers, commit state or source and target field properties are required

See also

ExecuteFormFieldScriptEvent, SetFormScriptLimits, GetFormScriptDiagnostics, RecalculateFormFields, GetFormCalculationGraphJSON, TPDFlibFormScriptAction