Advanced script triggers

Expert

Use OnObjectValidate, OnLayoutKeystroke, and OnWindowOpen to build responsive interfaces without polling.

What you'll learn

  • How OnObjectValidate differs from field validation rules
  • How to intercept and cancel keystrokes with OnLayoutKeystroke
  • How to use OnWindowOpen to initialize a window's state

Beyond the common OnObjectEnter/Exit triggers, FileMaker offers triggers for keystroke interception, window events, and field validation. Knowing when to use each one — and how to cancel the triggering event — separates functional solutions from polished ones.

1/3
1

OnObjectValidate for cross-field validation

Field validation rules only check a single field. OnObjectValidate fires before FileMaker commits the record, letting you run a script that checks relationships between fields and cancels the commit if needed.

FileMaker Script
# Script: Validate Invoice Dates
# Attached to InvoiceDueDate field via OnObjectValidate

If [ Invoices::DueDate < Invoices::InvoiceDate ]
  Show Custom Dialog [ "Due date cannot be before the invoice date." ]
  Exit Script [ Text Result: False ]   # False cancels the validation
End If
Exit Script [ Text Result: True ]      # True allows commit

Sign in to track your progress and pick up where you left off.

Sign in to FM Dojo