DocsState & inputs · FQL
On this page

Declare page state

Declare input values and a list selector in page state.

FQL state is declared in a special HTML comment in the document head.

index.html

The value after state = is parsed as a Frontbacked state object. JSON-compatible syntax is recommended. Comment state also accepts single quotes, unquoted identifier keys, and unquoted FQL values such as $now. Commas, balanced brackets, and valid expressions are required; malformed state fails visibly instead of being guessed.

You can also declare the same state object in JavaScript:

js

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

Frontbacked checks init({ state }) first. If no state is passed to init, it falls back to the {STATE} comment in the page.

List Selector State

Use state objects to define lists. The markup then points to that state value with f-list="$state.name".

FQL state configuration

Add this configuration inside your page’s {STATE} declaration. Inspect state shows its configuration; live queries and saved data run against your local site. Try a complete FQL page →

State selector definitions use special keys such as $list, $where, $order, $limit, and $page so they are not confused with ordinary post, settings, or local state data fields.

$list is intentionally a literal string. Values inside $where can still use FQL roots such as $query, $auth, $state, and $now. Quote keys that contain dots, such as "expiresOn.$gt", for portability; the {STATE} comment parser also accepts clear unquoted operator keys such as expiresOn.$gt. Plain keys like source, where, order, limit, and page remain ordinary state data.

Store recorded money, such as purchased investment principal and account balances, in FRL money fields. A small editable plan catalog can live in shared page settings with money-typed minimum amounts in the site currency. Validate those settings in FRL before checkout and save the purchased terms with the payment. For a catalog stored as posts, read its money fields with the normal money helpers:

index.html
index.html

Continue with Bind inputs and defaults.