ExecuteFormFieldScriptJSONA
表单、JavaScript 安全
描述
末尾的 A 表示 ANSI(char)DLL 入口点;ActiveX/COM 接口仅公开 Unicode 形式。其行为与 ExecuteFormFieldScriptJSON 相同,字符串参数按当前 SetAnsiMode 代码页解释
运行字段的校验、计算、格式化或按键动作,以 JSON 返回结果与事件状态,把 ExecuteFormFieldScriptEvent 带给 DLL 与 ActiveX 接口
语法
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);
参数
| 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