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

PageBuilderContactForm snippet ​

AJAX submit handler for Pro contact_form section. The section chunk calls it via FetchIt. Do not call this snippet from the resource template.

Purpose ​

Validates fields, sends mail through modMail, returns FetchIt JSON (success / field errors / redirect).

Where it is called ​

Chunk pagebuilderpro_contact_form calls PageBuilderFetchIt with snippet = PageBuilderContactForm and form = pagebuilderpro_contact_form_fields.

Parameters ​

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

FieldPurpose
pb_form_keyForm key from the section. An empty key is a validation error
pb_csrfToken from the chunk hidden field. A bad or empty token returns pagebuilder_fe_form_validation_error
repeater fieldsNames and rules from the section
nospamHoneypot. A filled field returns success before the CSRF check and does not send mail
pageIdOptional resource id from the form page

Where to look for the section:

SourcePriority
POST pageId1
resource_id on the FetchIt action2
current MODX resource3

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

Errors ​

SituationResponse
Missing sectionpagebuilder_fe_form_not_found
Direct call without FetchItpagebuilder_fe_fetchit_unavailable
modMail did not send mailpagebuilder_fe_form_send_error, mail is not treated as sent

Dependencies ​

PackageWhy
pagebuilderprocontact_form section
FetchItAJAX and inline errors

See also ​