Hey Tal
Thank you but no I should specify that my website will be for music theory education.
Yisreal helped me with this for randomizing the selections from a dataset:
import wixData from ‘wix-data’;
// clear any filters in the dataset
$w(“#dataset1”).setFilter( wixData.filter() );
// get size of collection that is connected to the dataset
let count = $w(“#dataset1”).getTotalCount();
// get random number using the size as the maximum
let idx = Math.floor(Math.random() * count);
// set the current item index of the dataset
$w(“#dataset1”).setCurrentItemIndex(idx);
This much helps me to have the variables in each question be different each time. Kind of like a self generating quiz
So here is an example question:
Question
What is the
“5th”
note in the key of
“C Major”?
Answer
“G”
What I am looking for is to have a user input box that can cross reference the dataset and see that the input either matches the appropriate answer or does not. I have found the language quiz post in the coding forum which could be a huge help, but the code he has would require using the specific answer in the code for every question. In my case this could lead to me doing this 1500 times for each possible iteration for each type of question. And there will be many more types of questions
His code for his language quiz is this:
export function controleer2_click() {
$w(“#textInput3”).onCustomValidation( (value) => {
if(value === “la”) {
$w(“#volgendebutton2”).show();
$w(“#uiteg2”).show();
$w(“#line10”).hide();
$w(“#antwoordbutton2”).hide();
$w(“#nogeens2”).hide();
$w(“#textInput3”).disable();}
else {
$w(“#line10”).show();
$w(“#uiteg2”).show();
$w(“#nogeens2”).expand();
$w(“#antwoordbutton2”).expand();}
});
Simple enough for me to plug in my own page elements IDs in place of the Dutch words. My focus is this part here:
if(value === “la”)
If i can replace the very specific “la” with some type of scripting (that can cross reference user input against what is in the appropriate answer column of my dataset) then I can have a self generating/self marking quiz and drill machine. That would save me literal days at the computer as well as many nights crying myself to sleep. But most importantly it would create a completely unique user experience every single time they log in.
Hopefully Im making sense here, as I said im very new to this but I feel like this is possible with a bit of know how and guidance
Thanks again for the help everyone