FM BetterForms
BF Editorfmbetterforms.com
1.0 dont use
1.0 dont use
  • Introduction
  • Features Summary
  • Getting Started
    • System Overview
    • Integration
      • 1. Configure FileMaker Server
      • 2. Add your Server to BetterForms
      • 3. Introduction to Hooks
      • 4. Create your first Site
      • 5. Create your first Page
      • 6. Configure your FileMaker File(s)
      • 7. Run your first Hook
      • Next Steps
    • Common Customizations
      • Introduction to Actions
      • Introduction to Buttons
      • Page Navigation
      • Displaying Data in a Table
    • Support
      • Hacking a Webpage
      • Learning JSON
  • Reference
    • Site Settings
      • Navigation
      • Slots / Code Injection
      • App Model
      • Site-wide Named Actions
    • Page Settings
      • Data Model
      • Card / Window Modals
      • Validation
        • Custom Validators
      • Misc Page Settings
    • Page Elements
      • Common
        • Button
        • Data Table
        • HTML
      • Grouping Elements
        • Tabs
        • panel
        • accordion
        • listrows
      • Uploading Files
        • dropzone
        • dropzone to S3
        • uploadCare
      • Misc Elements
        • Plain Text / Code Editor
        • signature
        • fullCalendar
        • rangeSlider
      • Payment Gateways
        • Authorize.net
        • PayPal
        • Stripe
      • Adding Custom Page Elements
    • Actions Processor
      • Named Actions
      • Actions
        • runUtilityHook
        • path
        • debounce
        • throttle
        • showAlert
        • showModal / hideModal
        • function
        • clipboard
        • cookie
        • setFocus
        • wait
        • emit
        • validate
        • channelJoinAnon
        • channelLeaveAnon
        • messageSend
        • messageSendAnonChannel
      • Authentication Actions
    • Script Hooks
      • Globals Variables
        • $$BF_Model
        • $$BF_App
        • $$BF_State
      • Keeping Keys Private
      • Reducing Payload Size
      • API Callback Endpoint
      • Common Hooks
      • Scoped Hooks
    • Users & Authentication
      • Managing User Accounts
      • Custom Login Pages
    • Advanced Configuration
      • Custom Domains
    • BF Utility Functions
    • BF Error Codes
    • Messaging
      • Adding users to channels
      • Removing users from channels
      • Sending messages
      • Get connected users
      • Get active channels
  • Usage Tips
    • Troubleshooting
      • Debugging
      • Frozen Actions Queue
    • JavaScript Tips
      • Calling Named Actions from HTML Vue Events
      • Calculations
    • System Overview
    • Forms Processor
      • Form Types
      • HTML & VueJS
      • Styling and Design
      • JS Caclulations and Functions
    • Customizing and Styling
      • Custom Components
      • Custom CSS
      • Custom Components
      • Page Pre-loaders
      • Favicon
    • Design Patterns and Best Practices
      • Working with environments
      • Handling Data
      • Saving Data
      • Optimization
      • Business Logic
      • UI / UX
  • Security
    • Authentication
    • Security White Paper
    • Firewalls
    • Technology Stack
  • Compatibility
Powered by GitBook
On this page
  • What is a Hook Script?
  • When do Hooks run?
  • How to name Hooks

Was this helpful?

  1. Getting Started
  2. Integration

3. Introduction to Hooks

Before we continue integrating, let's take a step back to understand the concept of Hooks in BetterForms

Previous2. Add your Server to BetterFormsNext4. Create your first Site

Last updated 3 years ago

Was this helpful?

What is a Hook Script?

A hook script is a script that inserts itself into normal workflow allowing additional control. See: . You interact with your application and the web client via hooks scripts.

BetterForms hooks fall into 2 categories:

Common hooks are scripts that are not contextual to a specific page. Typically they can be called from anywhere and do not contain information about the user's current page. (Eg: A login or registration hook are common hooks.) Common hooks are unified by a Site and therefore configured in the site settings.

Scoped hooks are bound to a specific page. Most of the hook scripts you will use throughout BetterForms will be scoped hooks. Scoped hooks are unified by the form and therefore configured in the form editor.

When do Hooks run?

A hook script can be triggered in a variety of places, here are just a few of the most common examples:

  • onLogin - a common hook used when a user first logs in to the web client

  • onFormRequest - a scoped hook that's optionally triggered when a page is first loaded

    • typically used to push data from FileMaker to the user

  • using the **** action anywhere that can run

    • typically used on a button that's intended to save data back to your FileMaker database

For a full reference of all available hooks, see this page:

How to name Hooks

The next few steps will ask you to create names for both a common hook set and a scoped hook set. Here are few tips to keep in mind:

  • The names of hooks are internal to your application and never displayed to the user

  • It's best to keep them short but descriptive for easy legibility

  • Hook names do not need to be unique throughout your site (see tip below)

  • As long as the names match between BetterForms and FileMaker, everything will work just fine.

FileMaker Analogy

A scoped hook name is referenced similarly to Get ( LayoutName ) in FileMaker. When a script is run, the scoped hook name is used to let your server-side script know the context that the user is sitting in.

This allows you to group scripts that run from the context of the same page together in your FileMaker scripts. Since these name don't need to be unique, you can group multiple pages together by having them share the same scoped hook name and your FileMaker scripts will see them as effectively the same page.

https://en.wikipedia.org/wiki/Hooking
runUtilityHook
actions
Script Hooks