ExecuteFormFieldScriptJSON

表單、JavaScript 安全性

描述

執行欄位的驗證、計算、格式化或按鍵動作,並以 JSON 傳回結果與事件狀態。它為 DLL 與 ActiveX 介面提供 ExecuteFormFieldScriptEvent

語法

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

型別程式庫 3.5 版起可在 IPDFlibrary4 上使用

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);

參數

Index以 1 為基準的欄位索引
Action0 驗證、1 計算、2 格式化或 3 按鍵
Value, Change初始 event.value 與 event.change
SelStart, SelEnd該變更取代的選取範圍
Flags1 willCommit、2 fieldFull、4 keyDown、8 modifier 與 16 shift 的總和

傳回值

JSON 物件,含 result(ExecuteFormFieldScriptEvent 的傳回值)、value、change、rc、selStart 與 selEnd;無效的 Action 傳回 {"result":0} 並帶 LastErrorCode 708

來源欄位即目標欄位。DLL 字串屬於執行個體傳回緩衝區,必須在下一次呼叫前複製

另請參閱

ExecuteFormFieldScriptEvent, SetFormScriptHostActionMode, GetFormScriptDiagnostics