ExecuteFormFieldScriptJSON
表单、JavaScript 安全
描述
运行字段的校验、计算、格式化或按键动作,以 JSON 返回结果与事件状态,把 ExecuteFormFieldScriptEvent 带给 DLL 与 ActiveX 接口
语法
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 开始的字段索引 |
|---|---|
| Action | 0 校验、1 计算、2 格式化、3 按键 |
| Value, Change | 初始 event.value 与 event.change |
| SelStart, SelEnd | 该变更所替换的选区 |
| Flags | 1 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