Creating a Quiz with Admin Screen

Motivation

In response to this question in the Community yesterday, here’s a quick guide to adding an Admin section to your quiz apps. The two main requirements were:

  1. The Admin screen should be PIN protected.
  2. The Admin screen should allow you to add extra questions to the quiz.

Demo

Take a look at the working example here (the PIN is “42”)

Component Tree

This app has 4 screens to display each of the different user interfaces.
component_tree

It also uses the LocalDB to store the questions and answers.

Quiz Screen

The quiz screen has a section in the middle of the page to ask and answer the questions. At the very top of the screen there’s a row containing the AdminButton. Clicking on this button will take the user to the PinScreen, so only an Admin (or someone who knows the PIN) will be able to access the admin area of the app.

quiz_screen

PIN Screen

At it’s simplest, the pin screen just needs a text input and a button. The following blocks are used to check if the users pin matches our pre-defined pin:

Admin Screen

The quiz screen contains two text inputs and two buttons. The text inputs are for entering the new question and answer. The two buttons are to update the localDB with the new question, and to navigate back to the Quiz Screen
admin_screen

The block are very simple, the text from the two text inputs is used as the question value and the answer value and stored in the LocalDB as a new row.

Clicking on the back button brings the Admin back to the QuizScreen to try out the new questions.
Screenshot 2020-06-10 at 14.23.01

Remix

If you want to remix this app, just copy the project into your own Thunkable account by clicking on the link below:
https://x.thunkable.com/copy/aa94cc47fc75a75e1ed3e61c75150cb9

(The link will expire in August 2020, so let me know if you need access in the future)

Thanks!

Hope you liked it. Leave a :heart: if you found it useful!

5 Likes

@domhnallohanlon yes it does work but i added a score which will increase by 1 per correct answer and decrease by 1 per incorrect answer. I also added an filter into the admin screen which can detect inappropriate questions. However, it is not working as I expected it to. It doesn’t detect that at all, it just ignores everything i type. How can i fix this?

Hey @zbk0612eip8w thanks for the feedback. If you are working on your own project, or adding additional features to one of our sample project can I ask that you please create a new topic in #thunkable-cross specifically about this?

The comments on tutorials should be for questions/feedback related directly to that tutorial.

Thanks!