Skip to content
  1. Extras
  2. PageBuilder
  3. Frontend output
  4. Snippets
  5. PageBuilderFormBuilder

PageBuilderFormBuilder snippet ​

AJAX submit handler for the Pro form_builder section. The chunk calls it through PageBuilderFetchIt. Do not call this snippet from the resource template.

Purpose ​

  1. Finds the form_builder section with the same schema key. Uses the published document when publishedRevision > 0, otherwise the draft.
  2. Checks CSRF and the honeypot.
  3. Writes the outbox in a transaction.

Mail is always queued. The recipient is the schema email. An empty field sends to emailsender.

A webhook is queued only when webhook is not empty. It is sent only to an https:// URL.

A delivery error after commit does not change the success JSON.

Submissions are not stored. Capability forms is required.

Where it is called ​

Chunk pagebuilderpro_form_builder passes snippet = PageBuilderFormBuilder and form = pagebuilderpro_form_builder_fields into PageBuilderFetchIt.

Parameters ​

There are no properties for a template call. Form POST:

FieldPurpose
pb_form_keySchema key. An empty key is a validation error
pb_csrfToken. A bad token returns CSRF token is invalid.
nospamHoneypot. A filled field returns success and does not send mail

Where to look for the section, same order as PageBuilderContactForm:

SourcePriority
POST pageId1
resource_id on the FetchIt action2
current MODX resource3

The chunk also passes action keys form_key, form_csrf, successMessage, and validationErrorMessage. form_csrf on the action wins over the session token.

Errors ​

SituationResponse
Missing section or schemapagebuilder_fe_form_not_found
No capability formspagebuilder_fe_form_unavailable
Too many requestsToo many requests.

Dependencies ​

PackageWhy
pagebuilderproform_builder section, capability forms
FetchItAJAX and inline errors

See also ​