Fabrik

New! Added support for PHP 7 and above. Updated 28 nov 2018

For Joomla there is only one quiz extension that is free – Ari Quiz Lite. 

If you need a point based quiz you need to buy a quiz extension or construct a quiz with the Fabrik component or using HTML with javascript and put in an article. 

Fabrik is complex and difficult to use, but if you know exactly what to do, it will take only 20 minutes to make a quiz and like using buyed quiz component. 

If you don't know how to make a quiz in Fabrik it can take weeks to figure out. I asked in the Joomla forum how to make a quiz with Fabrik and noone knew and I was recommended to buy a quiz extension instead as it was so difficult. 

First download and install Fabrik and also the calculation element plugin. Remember to enable the calculation element plugin. 

Make a form for your quiz. Remember to put introductory text for the quiz in Introduction space for the form and not in the list. Here is the tutorial to create list/form. I prefer in Form settings > Layout to Label and Label position to Above rather than Left if I use Bootstrap. 

Now go to Elements in Fabrik. Click on internal id and date Show in List disable (red) 

Click on New (element): 

Choose plugin: radiobutton 

Name: butt1

Label: The first question for the quiz

Group: the name of your form/list

List view setting: Show in List: Yes. 

Suboptions: 

Here are your radiobuttons value is the point for each answer and label is the text to the button.

Create the number of buttons you need for the quiz. 

Options per row: 1 means all buttons horizontally and if you put the number of buttons you have they are vertically. 

If you need more than one line of text for the question. Click on Options to the write and choose Forms > WYSIWYG editor for element labels to Yes.  The Label then becomes an editor. 

Then Save and Close 

Now you have created the first question with radio buttons. 

If your second question will use identical radiobuttons with identical points and labels. 

Open butt1 

Name: butt1 change to to butt2

Label: Change to second question. 

Then Save as Copy. Proceed so for all questions for the quiz. 

Each question must have a separate entry in database.like butt1, butt2, butt3 etc. 

If each question have different values or labels for suboptions. You must create a separate entry for each question like described above. 

When all questions are ready create a menu item for the form, so you can look if the questions and radiobuttons are OK at front page for your site. 

Now if you need calculation of points for your answers.

Click in Elements for New. 

Plugin: calc

Name: calc

Label: Sum points:

Group: Fill in group 

Click on More: 

Calculation:

return

{add___butt1_raw}+

{add___butt2_raw}+

{add___butt3_raw}+

{add___butt4_raw}+

{add___butt5_raw}+

{add___butt6_raw}+

{add___butt7_raw}+

{add___butt8_raw}+

{add___butt9_raw}+

{add___butt10_raw}+

{add___butt11_raw}+

{add___butt12_raw};

 

You have to change this for your number or questions.

For usage PHP 7 you have to change all {add___butt1_raw}+ to (int)'{add___butt1_raw}'+ (but don't for Ajax observe fields).

In addition Form with ID 1 will not work for ajax calculation.  You can in List view Copy it to a slightly other name and then open the calcs to activate them an then it will work, because it gets another ID than 1. 

Ajax calculation: Change to yes. 

Ajax observe fields: 

'{add___butt1},

{add___butt2},

{add___butt3},

{add___butt4},

{add___butt5},

{add___butt6},

{add___butt7},

{add___butt8},

{add___butt9},

{add___butt10},

{add___butt11},

{add___butt12}' 

You have to change this to your number of questions. 

List view settings: Show in List change to Yes. 

Save and Close. 

Now only one things remains an explaination of test results under the sum for points. 

Create New element: display

In box Options default: 

Put text like 1-10 point bad

11- 20 points not so bad etc 

Then fill all thats needed for an element like described above. 

Your quiz is now ready and when you click on all answer buttons the sum is thanks to ajax directly calculated and you dont need to click on Save. In forms you can create a Reset button and disable the Save button. These things is of course, when you use the quiz in frontend of your site. See the quiz made. 

You can make the quiz differently and not using Ajax and instead use Save button, But then you must Reload the page (fixed in the form area) and then hiding question elements and then showing text answers, but you have to Google for that. Needs some javascript to work.

 

Kommentar  
Thanks foor finally talking about Tutorial: How to make a quiz with Fabrik for Joomla