Features/Forms

Form events in JavaScript

Run your own code when a form is submitted, succeeds or fails, with the form data and the server response.

Each event receives the form (id, fields, FormData, page path, target element) and, for success and fail, the server response.

How it works

  • Registered event ids (group Forms): forms.submit, forms.success, forms.fail; the Form element exposes dh.submit, inputs dh.input and dh.change.
  • form object: id, fields (name -> value), data (FormData), url (pathname), event, target.
  • A submit listener may set form.id to null to stop the send.
  • Submit JS helper: admin.forms.Fn('submit', id, FormData, url).success(fn).fail(fn).

When to use it

  • Fire an analytics conversion on success
  • Show a custom toast on failure
  • Copy the submitted email to another script

Limitations

  • Client-side only; reading stored submissions needs the dashboard, Studio, the API or MCP.

Availability

  • Works in Designer.

Related features.

No card needed

Build it today.Pay when it goes live.

Every feature is unmetered while you build. Checkout opens the first time you publish.