On this page
Validate editable content
Choose types and validation for page editor fields.
Before you begin: Name editable fields.
Type and validate page editor fields
Give each editable binding its own type. Use f-type-text for f-text, and f-type-attr-NAME for the matching f-attr-NAME. These declarations apply to $settings fields and relative fields inside settings lists. They do not change post schemas or ordinary form input validation.
A type name such as number is shorthand for { "type": "number" }. The object form is literal JSON; it does not evaluate FQL expressions. Supported types are:
| Type | Accepted value | min and max |
|---|---|---|
string | Text | Text length in UTF-16 code units |
number | A finite number | Numeric bounds, inclusive |
integer | A finite whole number | Numeric bounds, inclusive |
money | An exact decimal amount with its currency | Exact decimal bounds, inclusive; decimal strings preserve precision |
boolean | true or false | Not supported |
url | A web, relative, anchor, email, or telephone link | Text length |
email | An email address | Text length |
Declared fields are required by default. Set "required": false to allow an empty value. Zero and false are supplied values. A declared string can contain up to 5,000 characters unless you choose a smaller limit. Other existing page editor limits still apply.
Without a type declaration, a text binding's maximum length is its authored default's length. Editable image sources and video posters accept replacement image URLs, including when the theme has no default image. Numeric-looking text such as 00123 stays text. An empty default without a declaration has no editable capacity; declare a type to let admins enter a value:
For typed fields, the editor saves numbers and booleans as actual numbers and booleans. Invalid entries show a field error and cannot be saved. Page setting saves enforce the same rules, including required fields inside list items. Optional empty values stay empty; they do not become zero or false. Reset restores the theme default.
In a settings list, declare types on the first item template. Its rules apply to every item, including nested lists:
Use the same declaration wherever the same setting is bound, including text and attributes on different elements. An explicit declaration takes precedence over an untyped binding; conflicting explicit declarations are a theme error. Keep FRL validation for values used by protected operations, including previously saved settings.
Money in the page editor
Use money for advertised prices and package minimums. The editor shows the amount's currency and saves an existing Frontbacked money value, with the decimal amount stored as text:
Here formatMoney is a registered theme function that calls Frontbacked.money.format. Keep the authored amount plain, without a currency symbol or grouping separators. Fresh defaults use the site's base currency. Existing saved amounts retain their currency; changing site currency does not convert or relabel them.
Money rules default to required. Set required: false for optional amounts. Amounts support up to 18 decimal places, and bounds are checked exactly. Prefer decimal-string limits such as "0.01". Saves reject malformed amounts, unsupported currencies, and money objects outside fields declared as money. Editing an existing multi-currency money value preserves its other currency entries.
Use Frontbacked.money.getAmount and Frontbacked.money.getCurrency in registered FQL formatters when an HTML attribute needs the amount or currency separately. Apply the same money declaration to every binding for the same setting, including formatted bindings. In FRL, money.get, money.compare, and money.format can consume the saved money value directly. Keep completed purchases, balances, payments, and investment terms in their protected FRL records.