Configuration

Webforms: Quiz and Trivia

Edited 2 years 2 months ago

Step by Step

 

Creating a Quiz:

 

1. Create a new Quiz, firstly, go to Structure > Webform and search for Quiz and Trivia. Are two types:

 

• Quiz and Trivia - Custom Page and email (demo): this model redirects the user to complete the form on a page customized according to his answers, and sends a message to his e-mail.

  • • Quiz and Trivia - Message and email (demo) - this model displays a message customized according to the user's when he completes the form, and sends a message to his e-mail.

 

2. Choose one of the models of Quiz, click on the arrow next to the "Build" button and select "Duplicate" to clone this form. 

     **Note: Is recommended to use a "quiz" at the beginning of the machine name of the form. Ex.:  quiz_my_game.

 

 

Adding questions with images or icon:

 

1. To add a question with images or icons, create a question of type "Entity checkboxes", "Entity radios" or any type that is Entity reference.

 

 

2. In the "Entity reference settings", set the configurations according the image bellow.

 

3. On "View arguments"  always use the name of the field "key" as a second argument for the view 

Ex.: [webform:id], question_4, in this case, "question_4" is the name used as the Key of the field.

**Note: Remember this Key, because it will be used to register the answer to the question.

 

 

Adding the answers to the questions with an image or icon:

 

1. Go to Structure > Taxonomy > Quiz and Trivia, click on "Add New Term", fill the fields correctly and click on "Save" to finish.

 

• Name: inform a name to the question

• Quiz: search by the name of the quiz that you created.

• Question KEY: inform the key (title) of the question that you created on the form.

 

• Image or icon: select an image or icon file to add to question.

 

Creating match rules:

 

1. In the "Settings - Emails/Handles" option of the form it is possible to create match rules according to the user's responses.

 

2. Use the 2 quiz templates created as examples and create your own matches.

 

 

3. To create the "Conditions" you will need a basic knowledge of HTML/WEBFORM, at this stage a developer can help you.

 

 

Adding Quiz as a Block:

 

1. Go to Structure > Block Layout > Add Custom Block and select Webform option.

 

2. Inform a description, language and select the Quiz that you created on the list.

 

3. You can remove the block "Context settings" and click on "Save" to finish.

 

4. To use this quiz on your site, go to the page that you want to add and follow the instructions about Quiz and Trivia component by clicking here.