DocsForm validation · FQL
On this page

Choose validation options

Look up schema keys and prepare images and empty fields.

Before you begin: Customize validation feedback.

Schema Keys

KeyPurpose
typestring, email, number, boolean, object, array, file, datetime, or post.
requiredRequire a present value. Empty strings, empty arrays, and missing files fail.
trim, lowercase, uppercaseNormalize string values before validation returns. email lowercases by default.
min, maxString length, number value, or array length limit.
patternRegular expression for string values.
enumAllowed values.
sameAsRequire the value to equal another state path.
acceptedRequire a boolean value to be true, useful for terms checkboxes.
maxSizeMaximum file size in bytes.
mimeTypesAllowed file MIME types.
maxDurationSecondsMaximum prepared video playback duration in seconds.
fieldsNested object schema.
of or itemsArray item schema.
messagesOptional custom messages by failed rule, such as required, email, min, or max.
feedbackMessage destination options.
validateCustom validation function that receives (value, state).
allowFalseTreat boolean false as valid.
allowEmptyStringTreat an empty string as valid.
allowEmptyArrayTreat an empty array as valid.

Prepare images and control preservation

check() always returns a Promise. Await it and send result.submitValue: this contains normalized, validated submission fields and prepared image files. The original selected files stay in form state. There is no separate checkAsync() method.

Custom schemas and Frontbacked.schemas.post() extensions both work. Public FRL schemas arrive with the page and are reused without a schema request on every check or upload.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

preserveImages: true preserves every image. Omit it or pass false to allow optimization. An array preserves named fields or groups; paths are relative to the checked form or submitted post. Use * for array elements. Unknown paths report an error. Pass the same preservation option to validation and the write method.

createPost, uploadPost, and updatePost prepare images even when you do not call check() first. Include type when updating posts with images so the correct schema is available. Already prepared files are reused when their rules match. Output must satisfy the field's allowed MIME types and size limit. When a browser cannot prepare an image, a valid original can still upload; oversized or disallowed originals report a validation error. Animated images are preserved.

For an existing error accumulator, use check(path, schema, { check: accumulator }).

Omit or explicitly clear fields

Ordinary object properties with null or undefined are omitted by post creation and editing. During a merged edit they leave existing values unchanged. false, 0, "", and [] remain meaningful values.

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

NULL explicitly stores null; UNSET removes the field. Required fields and all FRL permissions still apply. For direct JSON requests, their serialized forms are {"$frontbackedEmpty":"null"} and {"$frontbackedEmpty":"unset"}. Array entries cannot be omitted with raw null, undefined, or UNSET; use explicit NULL when the item schema permits null.