I’m using radiobuttons for a multiple choice quiz. If I have 10 radiobuttons, what is the easiest way to count the number of correct answers when the student submits?
![]()
I’m using radiobuttons for a multiple choice quiz. If I have 10 radiobuttons, what is the easiest way to count the number of correct answers when the student submits?
![]()
To keep the quiz secure, you definitely want to handle the scoring on the backend. If you store correct answers on the page (even in hidden variables/groups), users can inspect the page source and cheat easily.
YoU can use a Backend Workflow to compare submissions against the database securely:
1. Database Structure Create a Question data type with correct answer:
QuestionID (number)
CorrectAnswer (text)
2. The Backend Workflow Go to Backend Workflows and create an API workflow named gradeQuiz.
Parameters: Add text parameters for every Question and selected answer (`Q1` ans1, `Q2` ans2 and so one) and a student parameter (User type).
Action: Create a new thing (QuizResult).
Field 1: Student = student (parameter).
Field 2 (The Calculation): Set a number field Score to calculate the total immediately. You can sum them up using the :formatted as number operator, which turns a “yes” into 1 and “no” into 0 , Do a search with Quesiton and user anser if it return the question that mean the answer is correct , else its not.
3. The Trigger On your quiz page’s “Submit” button workflow:
Use the action Schedule an API workflow.
Select gradeQuiz.
Map the parameters to your page inputs ( Q1 = your question and ans1 = Radio Button A's value ans1 = Radio Button A's value, etc.).
Send Current User for the student parameter.
4. Displaying Results Once the workflow is scheduled, navigate the user to a results page. You can display the score by searching for the latest result: Do a search for QuizResults (Constraint: Created By = Current User, Sort: Created Date Descending):first item's Score
Thanks Baloshi. That seems extremely complicated, it could be done in a simple workflow adding up the right answers.