top of page
Colored logo.png
White Logo_edited.png
bottom of page
import { local } from 'wix-storage'; // Define the list of 71 values const valuesList = [ "Connecting with nature", "Gaining wisdom", // Add the rest of your values here ]; // Function to initialize the quiz function initializeQuiz() { // Create checkboxes for each value in the list valuesList.forEach((value) => { $w("#valuesContainer").append( `
` ); }); // Add a button to proceed to the rating part $w("#nextToRatingButton").onClick(() => { // Capture selected values const selectedValues = getSelectedValues(); // Store selected values in local storage local.setItem("selectedValues", JSON.stringify(selectedValues)); // Hide the value selection part and show the rating part $w("#valueSelectionPart").hide(); $w("#ratingPart").show(); }); } // Function to get the selected values function getSelectedValues() { const selectedValues = []; valuesList.forEach((value) => { const checkbox = $w(`#${value}`); if (checkbox.checked) { selectedValues.push(checkbox.value); } }); return selectedValues; } // Function to update the selections based on changes function updateSelections(updatedValues) { valuesList.forEach((value) => { const checkbox = $w(`#${value}`); if (updatedValues.includes(value)) { checkbox.checked = true; } else { checkbox.checked = false; } }); } // Function to capture ratings for each value function captureRatings() { const ratings = {}; // Store ratings in an object with value names as keys valuesList.forEach((value) => { const rating = $w(`#rating_${value}`).value; // Assuming you name your rating elements with a "rating_" prefix ratings[value] = rating; }); // You now have an object 'ratings' where each key is a value, and the value is the corresponding rating. // You can do further processing with these ratings, such as storing them or displaying results. // Clear selected values from local storage local.removeItem("selectedValues"); // Redirect or perform any other actions here } // Initialize the quiz initializeQuiz(); import { local } from 'wix-storage'; // Define the list of 71 values const valuesList = [ "Connecting with nature", "Gaining wisdom", // Add the rest of your values here ]; // Function to initialize the quiz function initializeQuiz() { // Create checkboxes for each value in the list valuesList.forEach((value) => { $w("#valuesContainer").append( `
` ); }); // Add a button to proceed to the rating part $w("#nextToRatingButton").onClick(() => { // Capture selected values const selectedValues = getSelectedValues(); // Store selected values in local storage local.setItem("selectedValues", JSON.stringify(selectedValues)); // Hide the value selection part and show the rating part $w("#valueSelectionPart").hide(); $w("#ratingPart").show(); }); } // Function to get the selected values function getSelectedValues() { const selectedValues = []; valuesList.forEach((value) => { const checkbox = $w(`#${value}`); if (checkbox.checked) { selectedValues.push(checkbox.value); } }); return selectedValues; } // Function to update the selections based on changes function updateSelections(updatedValues) { valuesList.forEach((value) => { const checkbox = $w(`#${value}`); if (updatedValues.includes(value)) { checkbox.checked = true; } else { checkbox.checked = false; } }); } // Function to capture ratings for each value function captureRatings() { const ratings = {}; // Store ratings in an object with value names as keys valuesList.forEach((value) => { const rating = $w(`#rating_${value}`).value; // Assuming you name your rating elements with a "rating_" prefix ratings[value] = rating; }); // You now have an object 'ratings' where each key is a value, and the value is the corresponding rating. // You can do further processing with these ratings, such as storing them or displaying results. // Clear selected values from local storage local.removeItem("selectedValues"); // Redirect or perform any other actions here } // Initialize the quiz initializeQuiz();