Lifecycle Hooks
Lifecycle hooks are client-side workflow entry points, not FileMaker server hooks.
Use them when you want BetterForms to run named actions automatically at specific moments in the browser lifecycle.
For FileMaker developers, the key rule is:
if BetterForms is calling your FileMaker script, that is a server hook
if BetterForms is automatically running a named action in the browser, that is a lifecycle hook
At A Glance
onAppLoad
App-wide
After the app/site loads in the browser
onFormLoad
Page-specific
After a page/form has loaded in the browser
onBeforeMount
Component
Before a custom component renders
onMount
Component
After a custom component renders to the DOM
onUpdated
Component
After a custom component updates
onBeforeDestroy
Component
Before a custom component is removed
onDestroyed
Component
After a custom component is removed
onAppLoad
onAppLoad is a global named action that runs after the app/site has loaded.
Typical uses:
initialize app-wide browser-side state
set up PWA behavior
load UI libraries or feature flags
run startup actions after a refresh
Notes:
This is a client-side workflow, not a FileMaker server call.
It is typically defined in app-level named actions.
If needed, an
onAppLoadworkflow can still call the server by includingrunUtilityHook.
onFormLoad
onFormLoad is a page-level named action that runs after a form/page loads.
Typical uses:
trigger browser-side setup for a page
consume a token from the URL and run an auth flow
kick off a page-specific action sequence after load
run a
runUtilityHookas part of the load sequence when the page needs server data
Notes:
If actions are returned from
onFormRequest, those are queued beforeonFormLoad.onFormLoadis a very common place to run auth-related actions likeauthVerifyor token-basedauthLogin.
Component Lifecycle Hooks
Custom components support their own lifecycle hooks through component named actions.
onBeforeMount
Runs before the component renders and is useful for blocking setup work such as:
loading external libraries
preparing configuration
doing work that must finish before the component displays
onMount
Runs after the component is rendered to the DOM.
Use it for:
DOM-dependent initialization
third-party library startup
attaching behavior to rendered elements
onUpdated
Runs after component data changes and the component updates.
Use it for:
syncing a library instance with new data
updating UI integrations after state changes
onBeforeDestroy
Runs before the component is removed.
Use it for:
cleanup work
stopping listeners
tearing down library instances
onDestroyed
Runs after the component is removed.
Use it for any final cleanup that should happen after teardown.
About onError
You may also see onError mentioned in some specialized frontend-tool or integration contexts.
For this docs section, treat it carefully:
onErroris not documented here as a general app-wide lifecycle hook in the same way asonAppLoadoronFormLoadwhen a specific feature provides its own
onErrorcallback or handler, document it with that feature
This avoids mixing generic lifecycle hooks with feature-specific error callbacks.
If your goal is app-level error behavior rather than a lifecycle trigger, see the existing error-handling references:
BetterForms Error Pages API for app-level
errorHandlersand custom/errorpage behaviorfunction for function-action error handling and code
10501
Relationship To Server Hooks
Lifecycle hooks do not replace server hooks.
Instead, they often work together:
a lifecycle hook starts a browser-side workflow
that workflow may call
runUtilityHookthe server hook runs in FileMaker
BetterForms resumes the client-side action flow
Related Pages
Last updated
Was this helpful?