Forms

Forms Attribute Contract

2 min read

Use these classes and attributes so frontend JavaScript and server validation share the same contract. Secrets never belong in markup.

Root

<form
  class="notifal-form"
  data-notifal-widget="form"
  data-form-id="123"
  data-form-multi-step="true"
  data-success-message="Thanks! We will be in touch."
  data-success-behavior="message"
  data-success-redirect=""
  data-error-message=""
  data-submitter-email-field="email"
  data-primary-color="#7e2bd2"
  data-captcha="inherit"
>
AttributePurpose
class="notifal-form"Required root class
data-notifal-widget="form"Widget detector for HTML Builder and assets
data-form-idForm CPT ID
data-form-multi-stepEnable multi-step UI when true
data-success-messageMessage shown after a successful submit
data-success-behaviormessage, redirect, or both
data-success-redirectSame-site URL used when behavior includes redirect
data-error-messageOptional custom fallback error message
data-submitter-email-fieldField machine name used for visitor confirmation email
data-primary-colorBrand accent for the form
data-captchainherit, none, google, or turnstile (keys come from Settings)

Fields and steps

PieceMarkup
Step.notifal-form-step + data-step-index + optional data-step-title
Field wrap.notifal-form-field-wrap
Field.notifal-form-field + data-field-type + data-field-name
Requireddata-required="true"
Uniquedata-unique="true"
Regexdata-regex (server-validated, fail-closed)
Optionsdata-options for select / radio / checkbox groups
Label / placeholderdata-label, data-placeholder
Conditionaldata-conditional-field, data-conditional-operator, data-conditional-value
Navigation`data-form-action="next\back\submit" on .notifal-form-nav`

Field types

text, email, tel, number, textarea, select, radio, checkbox, hidden

Conditional operators

equals, not_equals, contains, not_empty, empty

Forbidden attributes

Do not emit attributes such as data-api-key, data-webhook, data-mailchimp, data-secret, data-auth, or other secret-bearing names. Secrets belong on the Form CPT and Settings → Forms only.