Docly Developers
Section12 pages

Validation functions

Helper functions to easily validate values in API functions.

isNumber(value, minValue?, maxValue?)Checks if the value is a number or numeric text. Text may use a comma as decimal separator and spaces as thousands separators ("1 234,5" is…isString(value, minLength?, maxLength?)Validates that a value is text with at least minLength and at most maxLength characters. Numbers and other non-text values give false, and…areEqual(value1, value2)Checks if value1 and value2 are equal. Typically used to validate that two fields match (e.g. password confirmation). Values are compared…areNotEqual(value1, value2)Checks that two values are not equal. The exact opposite of areEqual: the same .NET comparison is used, so areNotEqual(null, null) is false.isNull(value)Checks if specified value is null. Useful for null-checks in form validation or before-write checks.isNotNull(value)Checks if specified value is not null.isName(value)Checks that the text contains a space, as a simple test for "first name and last name". "Richard Dawson" gives true and "Richard" gives…isEmail(value)Validates if a string is an email address, using the .NET MailAddress parser. The check is lenient: it also accepts a display-name form…isDate(value)Checks if the value is a date, or text that can be read as one. Recognized text formats are ISO formats such as 2023-01-01…isDateTime(value)Checks if the value is a date/time, or text that can be read as one. Text is first parsed with .NET's general date parser (invariant…isInteger(value, minValue?, maxValue?)Checks if the value is a whole number, or text containing one ("123"). Decimals such as 5.5 or "5.5" give false, and the value must fit in…assert(description, resultCode?)Deprecated: prefer standard JavaScript throw new Error(...). Throws a validation error with the given message and an optional result code…