THotPDF.EvaluateLoadedFieldJavaScript Method

Evaluates the supported safe subset of one loaded field action without starting a JavaScript engine

Declaration

function EvaluateLoadedFieldJavaScript(FieldIndex: Integer;
  Trigger: THPDFFormFieldActionTrigger; const InputValue: AnsiString;
  out Evaluation: THPDFJavaScriptEvaluationResult): boolean;

Result

Returns True when at least one supported action executed; Evaluation reports the resulting value, validation acceptance, operation count and any rejection reason

Supported expressions

The evaluator supports boolean, number, string, null, undefined, and array literals; field and event.value reads; array indexing; arithmetic, unary, comparison, equality, short-circuit logical and conditional operators; and assignment to event.value or event.rc

The allowlist includes AFSimple_Calculate, AFRange_Validate, number and string conversion, parseFloat, parseInt, isNaN, selected Math functions, Date.parse, Date.UTC, Array.isArray and bounded string and array properties and methods

Date operations are deterministic and timezone-independent: ISO-like input without an offset is interpreted as UTC, whilst explicit Z and numeric offsets are honoured

Safety boundary

The parser accepts bounded declarative calculations and validation only, and rejects loops, dynamic evaluation, application access, submission, import, launch and other active content

Each call is limited to 8,192 script bytes, 32 statements, 4,096 expression bytes, 32 parser levels, 1,024 operations, 64 arguments, 128 array items, 65,536 string bytes and 262,144 bytes of tracked values; exceeding any limit fails closed with a diagnostic result

Related APIs