Skip to content

Actions ​

This page is the action index. Use it to see which actions are supported in the current browser runtime and then click through to the detailed action pages.

What Actions Are ​

Actions are browser-side workflow steps processed by the BetterForms actions queue.

Use them to:

  • navigate or open UI elements
  • run browser-side JavaScript
  • trigger named actions
  • call FileMaker through actions such as runUtilityHook

Actions are not the same thing as FileMaker hooks. Hooks are server-side scripts; actions are client-side workflow steps that may call those hooks.

Core Actions ​

ActionSummaryDetails
showModal / hideModalOpens or closes the standard modal dialogshowModal / hideModal
showCardModal / hideCardModalOpens or closes a card modal that renders another pageshowCardModal / hideCardModal
showAlertShows a toaster-style alertshowAlert
pathNavigates to another page, URL, or target windowpath
runUtilityHookCalls the scoped server utility hook workflowrunUtilityHook
runOnCompleteHookTriggers the completion hook flow and waits before continuingrunOnCompleteHook
validateRuns page validationvalidate
setFocusFocuses or selects an input elementsetFocus
scrollToScrolls to a target elementscrollTo
waitDelays the next queued action for a specified number of millisecondswait
debounceDelays repeated actions until activity settlesdebounce
throttleLimits how frequently an action can runthrottle
functionRuns JavaScript in the client workflowfunction
emitEmits an internal event-bus eventemit
mapInfoWindowEmits a component-facing map info-window eventmapInfoWindow
clipboardInteracts with the clipboard helperclipboard
cookieSets or removes browser-side cookiescookie
consoleErrorWrites a message to the browser error consoleconsoleError
namedActionRuns another named action / workflow by nameNamed Actions

Authentication Actions ​

These special actions allow you to create custom login and registration pages. See this page for more:

authentication-actions.md

Messaging Actions ​

ActionSummaryDetails
messageSendSends a BetterForms messagemessageSend
messageSendAnonChannelSends a message to an anonymous channel flowmessageSendAnonChannel
channelJoinAnonJoins an anonymous channelchannelJoinAnon
channelLeaveAnonLeaves an anonymous channelchannelLeaveAnon

Payment Actions ​

ActionSummaryDetails
showStripeCheckoutTriggers the Stripe checkout event for a configured formshowStripeCheckout

OAuth Actions ​

ActionSummaryDetails
authLoginOauthFinalizes OAuth login on the callback pageauthLoginOauth / oauthLoginHook
oauthLoginHookLegacy alias for authLoginOauthauthLoginOauth / oauthLoginHook

PWA Actions ​

ActionSummaryDetails
pwaCustomInstallCaptures the browser install prompt for later usepwaCustomInstall
pwaPromptInstallTriggers the stored browser install promptpwaPromptInstall
pwaPromptPushPermissionRequests push-notification permission and registers the browser subscriptionpwaPromptPushPermission
pwaPushNotificationSendSends a push notification through BetterFormspwaPushNotificationSend

AI / Tooling Actions ​

ActionSummaryDetails
llmToolCallMaps LLM-requested frontend tools into BetterForms named actionsllmToolCall
llmToolCallResponseSends a frontend tool result back to the tool-response servicellmToolCallResponse
llmQueryStopRequests that an active /llm/query stream stopllmQueryStop
assistantStopRequests that an active assistants run stopassistantStop

Usage ​

Actions can run from many places:

  • $$BF_Actions payloads returned from supported FileMaker hooks
  • navigation menu items
  • page elements such as buttons
  • named actions
  • *_actions schema keys (where supported)

Wherever you see an actions key in BetterForms, it can be either:

  • a single action object
  • an array of action objects to run in sequence

$$BF_Actions - Actions Array ​

$$BF_Actions is the browser action array that applicable FileMaker hooks can return.

Each array element is one action object. BetterForms queues them and runs them in order.

For user-facing docs and custom scripts, clear queued actions with the public BetterForms helper:

javascript
BF.actionsClear()

Stacking actions from FileMaker (Helper custom functions) ​

The Helper File’s BF_SetAction… custom functions (for example BF_SetAction, BF_SetAction_Function, BF_SetAction_Path, and action-specific helpers like BF_SetAction_showAlert) append one action object to the JSON array in $$BF_Actions. Each function reads the current $$BF_Actions, adds the next action at the end, and returns the full updated array.

Pattern: After each call, set $$BF_Actions to the return value of the custom function. The next call then appends to that result.

Do not use FileMaker’s List() (or similar) to merge multiple actions—those helpers already merge into the JSON array.

Your Helper may ship multiple versions of a function (for example a generator variant). Use the names from your Helper file; the examples below use the common names without a _G suffix.

Example script steps:

filemaker
Set Variable [ $$BF_Actions ; Value: BF_SetAction_Function ( "model.ui.isLoading = true;" ) ]
Set Variable [ $$BF_Actions ; Value: BF_SetAction_Path ( "/orders" ) ]
Set Variable [ $$BF_Actions ; Value: BF_SetAction_Function ( "model.ui.isLoading = false;" ) ]

Generic action + options (second parameter is a JSON string for options, or "" when empty):

filemaker
Set Variable [ $$BF_Actions ; Value: BF_SetAction ( "runUtilityHook" ; "{ \"type\": \"save\" }" ) ]

For other globals built by FileMaker ($$BF_Model, $$BF_App, etc.), see Global Variables for Hooks. Only $$BF_Actions is an ordered action queue built this way.

Other places you can use actions ​

actionsBeforeComplete can be added to schema.form and BetterForms will run that action array when present.

The Action Object ​

KeyTypeDefaultDescription
actionstringThe name of the action
functionstring{optional} All actions can also take a function. This is processed just before the action is executed. This function can be an JS code and can also easily change the action parameters itself of any other environmental value. This is handy for pre-processing data prior to an action.
preventClonebooleanfalse

{optional} When true, BetterForms does not strip object references before running the action array. By default, actions are cloned so they are decoupled from the original objects that created them.

nonBlockingbooleanfalse{optional} When added to the action and true, the actions processor will not wait for the action to complete before starting the next action. This is useful when you have a blocking action but still want other things to run (like slow process utility hooks)
optionsobjectThis object may be optional depending on the specific settings needed by a given action.

function On Any Action ​

Any action object can also include a function key. When present, BetterForms runs that JavaScript just before the action executes.

Use this for pre-processing or mutating the action/options just before the action runs.

This is different from the standalone function action, which is itself the action being executed.

Calling Named Actions ​

Triggering Actions on Field Changes ​

All field element types support an onChanged_actions key. This key can contain actions that will be run when the elements data model changes.

// This will show an alert when the checkbox is toggled
{
  "styleClasses": "col-md-4",
  "text": "Enter Address Manually",
  "type": "bfcheckbox1",
  "model": "manualAddress",
  "onChanged_actions": [
    {
      "action": "showAlert",
      "options": {
        "text": "This is the alert message text",
        "title": "Hello World",
        "type": "information"
      }
    }
  ]
}

Clearing Actions ​

javascript
// in a function key
if (!model.isRegistered) {
  BF.actionsClear()
}

Klai Studio documentation