ExecuteFormFieldScriptJSON
Forms, JavaScript safety
Description
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 TPDFlib.ExecuteFormFieldScriptJSON(Index, Action: Integer; Const Value, Change: WideString; SelStart, SelEnd, Flags: Integer): WideString;
ActiveX
Function PDFlib::ExecuteFormFieldScriptJSON(Index As Long, Action As Long, InputValue As String, Change As String, SelStart As Long, SelEnd As Long, Flags As Long) As String
Available on IPDFlibrary4 from type library version 3.5
DLL
const wchar_t* DLExecuteFormFieldScriptJSON(int InstanceID, int Index, int Action, const wchar_t* Value, const wchar_t* Change, int SelStart, int SelEnd, int Flags);
const char* DLExecuteFormFieldScriptJSONA(int InstanceID, int Index, int Action, const char* Value, const char* Change, int SelStart, int SelEnd, int Flags);
Parameters
| Index | The one-based field index |
|---|---|
| Action | 0 validate, 1 calculate, 2 format or 3 keystroke |
| Value, Change | The initial event.value and event.change |
| SelStart, SelEnd | The selection the change replaces |
| Flags | Sum 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