I am trying to create a Multiple Choice Quiz (6-7 questions) where persons select the correct answers from a choice of 4 radio buttons (for each question) and if the get a question right there is some form a count associated with the quiz at the end . I.e. 5 out of 8 is displayed when the button is clicked.
Thanks for your response but it doesn’t giv e me what I was after. I now how to create a form. I am really looking for how to do the count and display the count at the end of the quiz? That is not in the user input examples that i can find. I cant find what code to write / use for the count?
It is possible with slideshow.
You can use selectSlide() to change slides.
In general, let’s say you have a submit button for answers (maybe even outside of the slideshow) called ‘submitButton’, and slideshow called ‘quiz’. And let’s say that each slide has a radio button group called ‘radioButtonOptions’. I would save a global variable and set an onClick function for the button that updates it and changes the slide. General skeleton just to get the idea:
let scoreForQuiz = 0;
let currentSlideToShow = 0;
export function submitButton_onclick() {
//get the user selected value.
//see https://www.wix.com/code/reference/$w.RadioButtonGroup.html#value
//you can also do so by selectedIndex.
//see https://www.wix.com/code/reference/$w.RadioButtonGroup.html#selectedIndex
const valueFromSlide = $w('radioButtonOptions').value;
if (valueFromSlide === correctAnswer) {
scoreForQuiz++; //adding 1 point to the score
}
currentSlideToShow++; // moving the index to the next question
$w('#quiz').selectSlide(currentSlideToShow);
}
I need help with something similar to CRoberts, above.
I’m devising a series of questionnaires each with 25 questions. Each question is to have 4 options (radio buttons) out of which only 1 option is to be the correct answer to the given question.
Once the user clicks the radio button, that option is to be saved, I. e., the result is not displayed immediately, and if the user gets a question right, that is counted and displayed at the end, after the quiz.
The user is to then click NEXT (another button), to be taken to the following question. Once NEXT is clicked the user does not have the option of going back to change the option earlier checked.
When all the questions are answered, list is to appear displaying the following:
1: the question (listed in the order they appeared in the questionnaire)
2: the option that the user clicked;
3: the correct option irrespective of whether the user clicked the right or wrong answer;
4: an explanation answering the question, again irrespective of whether the user click the right or wrong option;
5: A summary stating:
Questions answered correctly #
Questions attempted #
Percentage of correct answers %
I also need buttons to guide the user to the next test, or exit the app.
Would someone please guide me on where I might get readymade code for this ? I need to plug the code into a Wix site.