Loading...
Skip navigation
Please note that this documentation is for the most recent version of this extension. It may not be relevant for older versions. Related documentation can be found in the documentation directory of the extension.

Feedback form

The feedback form allows participants to provide feedback or leave contact details directly after completing a quiz. This is particularly useful for lead generation or for improving quiz content.

What is the feedback form?

A feedback form is displayed as part of a quiz result. When a participant reaches a certain score range, an individually configured form can be presented to them along with their result. The entered data is validated and sent via email to a configurable address.

Configuration and fields

The definition of the form fields is done via the "Feedback Field" record. A quiz result can have any number of these fields.

The definition of the fields can be found in the file vendor/codingms/quiz/Configuration/TCA/tx_quiz_domain_model_feedbackfield.php.

  • Title (title): The label of the field in the form (e.g., "Name" or "Your opinion").
  • Key name (keyname): An internal technical name for the field (lowercase, without spaces). This is used in the email template and in validation.
  • Type (type): The field type determines the input type:
    • Input: Single-line text field.
    • Textarea: Multi-line text field.
    • E-Mail: Text field with integrated email validation.
    • Select: Selection menu (drop-down).
  • Required field (required): If activated, the field must be filled in before the form can be submitted.
  • Options (select_options): Only for the type Select. Here, the selection options are entered line by line.

Technical logic

The processing of the form takes place in two main components:

Backend: JsonApiController.php

The file vendor/codingms/quiz/Classes/Controller/JsonApiController.php handles the server-side processing:

  • sendFeedbackAction: Receives the form data, loads the associated quiz result, and starts validation.
  • validateForm: Checks the required fields and email formats based on the TCA configuration.
  • sendFeedbackMail: Prepares the email with the entered data and the quiz report and sends it.

Frontend: QuizFeedbackForm.js

The file vendor/codingms/quiz/Resources/Public/JavaScript/QuizFeedbackForm.js controls the behavior in the browser:

  • Intercepting the submit event and sending the data via fetch (AJAX).
  • Displaying loading information during transmission.
  • Dynamic display of success or error messages.
  • Visual marking of validated fields (Bootstrap classes is-valid / is-invalid).

Templating

The appearance of the form and the sent email can be customized via Fluid templates.

Form Partial

File: vendor/codingms/quiz/Resources/Private/Partials/Quiz/FeedbackForm.html

This partial renders the actual HTML form. It uses an f:for loop over {result.feedbackFields} and an f:switch to output the appropriate Fluid form ViewHelper (e.g., f:form.textfield or f:form.select) depending on the field type. The form is optimized for Bootstrap 5 by default.

Email Template

File: vendor/codingms/quiz/Resources/Private/Templates/Email/FeedbackMail.html

This template defines the content of the notification email. The following variables are available:

  • {subject}: The subject of the email.
  • {quiz}: The Quiz object.
  • {quizResult}: The QuizResult object to which the feedback belongs.
  • {fields}: An array of the submitted form fields. Each element contains:
    • {field.title}: The title of the field.
    • {field.value}: The value entered by the user.
  • {report}: An array with the details of the quiz progress:
    • {report.questions}: List of answered questions including given answers.
    • {report.questionsCorrect}: Number of correctly answered questions.
    • {report.questionsCount}: Total number of questions.
    • {report.correctPercent}: Percentage of correct answers.
Documentation
TYPO3 Quiz Extension

TYPO3 Quiz

TYPO3 - Quiz extension for creating simple Quiz for (self) testing and more

Menu

Contact request

You can contact us at any time

Stop! Playing in the meantime?
Stop! Playing in the meantime?
Stop! Playing in the meantime?

Stop! Playing in the meantime?

Break the highscore

Press Start
Contact request
Screenreader label
Security question
NPX_________YFL______
O______8____W_____YSW
I15___MLB___UFI______
__2____M____J_8___YT6
1OI_________DOW______