ExecuteFormFieldScriptJSONA

Forms, JavaScript safety

Description

The trailing A denotes the ANSI (char) DLL entry point; the ActiveX/COM surface exposes only the Unicode form. Behaviour is identical to ExecuteFormFieldScriptJSON and string arguments are interpreted using the current SetAnsiMode code page

Runs a field validation, calculation, formatting or keystroke action and returns the result and event state as JSON. It provides ExecuteFormFieldScriptEvent to the DLL and ActiveX interfaces

Syntax

Delphi

Function DLExecuteFormFieldScriptJSONA(InstanceID, Index, Action: Integer; Value, Change: PAnsiChar; SelStart, SelEnd, Flags: Integer): PAnsiChar;

DLL

const char* DLExecuteFormFieldScriptJSONA(int InstanceID, int Index, int Action, const char* Value, const char* Change, int SelStart, int SelEnd, int Flags);

Parameters

IndexThe one-based field index
Action0 validate, 1 calculate, 2 format or 3 keystroke
Value, ChangeThe initial event.value and event.change
SelStart, SelEndThe selection the change replaces
FlagsSum of 1 willCommit, 2 fieldFull, 4 keyDown, 8 modifier and 16 shift

Return values

A JSON object with result (the ExecuteFormFieldScriptEvent return value), value, change, rc, selStart and selEnd; an invalid Action returns {"result":0} with LastErrorCode 708

The source field is the target field. DLL strings belong to the instance return buffer and must be copied before the next call

See also

ExecuteFormFieldScriptEvent, SetFormScriptHostActionMode, GetFormScriptDiagnostics