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

PageBuilderQuiz snippet ​

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

Purpose ​

Validates answers and contacts, calculates the total on the server in pricing mode, sends mail through modMail, and returns FetchIt JSON. A success payload can include total, currency_suffix (default ₽), and redirect_url.

Where it is called ​

Chunk pagebuilderpro_quiz calls PageBuilderFetchIt with snippet = PageBuilderQuiz and form = pagebuilderpro_quiz_form.

Parameters ​

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

FieldPurpose
pb_quiz_keyQuiz key
answer[...]Answers
contact fieldsContacts
nospamHoneypot. A filled field returns success and does not send mail
pageIdOptional resource id

Where to look for the section:

SourcePriority
POST pageId1
resource_id on the FetchIt action2
current MODX resource3

The chunk passes action keys quiz_key, successMessage, and validationErrorMessage.

Errors ​

SituationResponse
Missing sectionpagebuilder_fe_quiz_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
pagebuilderproquiz section
FetchItAJAX and inline errors

See also ​