Today we will create a quiz widget in Blox that will looks something like this:
This is a blox exercise to show a simple use case for custom actions.
All resources used to create this dashboard available here
The first step is creating a data source file.
You can see in blox_trivia.csv we have some questions answers. The correct answer is also stored so that we can check the users answers.
Connect blox_trivia.csv to the smodel.
Our blox widget is relatively simple:
We add all the columns from the blox_trivia.csv table to our blox widget as items and then create the appropriate text boxes.
Next we set up the choice set
The title is what will be displayed to the user. The value is what will be passed to our action.
Go to blox and create a new custom action and paste in action.js.
This is a simple action. We get the user's answer from our selectVal and the correct answer from the results part of our payload. We compare the correct answer and the user answer and display an alert.
Users move to the next question by clicking the carousel.
I hope this was fun and educational.
Let me know if you have questions or issues.
Please sign in to leave a comment.