Docsfrontbacked.js reference
On this page

Dialogs reference

Open confirmations and dialogs from page code.

Method signatures

js

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

Field help

Keep a form easy to scan with an info button beside a field label. Put its explanation in f-info; Frontbacked opens it in a focused dialog with a Got it button and locks scrolling behind it.

index.html

The explanation is plain text. Keep essential warnings and validation messages visible next to the input.

Before you begin: State and schemas reference.

Confirmation

Frontbacked.confirm(message, title?) shows Frontbacked's built-in confirmation modal and resolves to true or false:

js

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

Dialogs

Create account details, checkout previews, and editing forms with an HTML <dialog>, then open or close it by ID:

index.html

Pass the ID without #. open(id) shows a modal dialog with its ::backdrop, browser focus handling, and background scroll locking. close(id) closes that dialog and restores scrolling after the last overlay closes. Escape and forms with method="dialog" also release the scroll lock. Removing an open dialog releases its lock too.

Style dialog and dialog::backdrop with your theme CSS, and use ordinary FQL bindings inside the dialog. In theme admin pages, the backdrop covers the entire admin screen.

Both methods return true when they change the dialog's open state and false when it is already in the requested state. A missing ID or an element that is not a <dialog> throws an error. You can also call these methods from functions registered with Frontbacked.functions.define() for FQL event bindings.

Continue with Navigation reference.