I’m having trouble with
How do I save radio button values / data to be displayed later on?
I believe I should be using import{ session }from "wix-storage-frontend";
But I can’t figure out how to save the value when a button is clicked. This button not only needs to save the data but also move to the next page.
Working in
Wix Studio Editor
Site link
Still in testing and I don’t have permission from the client to share the site
What I’m trying to do
First, I want to say the website I am working on moves in a liner fashion.
I have 3 pages with radio buttons whose value needs to be saved and displayed on a later page. When displayed, there will be text displayed depending on which value was chosen/saved.
What I’ve tried so far
I’ve tried using import{ session }from "wix-storage-frontend";
The code for the button/radio buttons I’ve been using is:
$w('#btnNextYes').onClick((event) => {
const inputValue = $w('#rdbGroupTested').value;
local.setItem('mySavedValue', inputValue);
wixLocation.to("/learn-about-your-health-1-1");
})
$w('#btnNextNo').onClick((event) => {
const inputValue = $w('#rdbGroupTested').value;
local.setItem('AboutHealth1', inputValue);
wixLocation.to("/learn-about-your-health-1-1");
})
But it doesn’t seem to work. The code I’m using to display the text is:
let AnswerAboutHealth1 = local.getItem("AboutHealth1");
switch (AnswerAboutHealth1) {
case "yes":
$w('#txtSummaryAboutHealth1').show();
$w('#txtSummaryAboutHealth1').text = "You said you have been treated for hepatitis c before"
console.log("You said you have been treated for hepatitis c before")
break;
case "no":
$w('#txtSummaryAboutHealth1').show();
$w('#txtSummaryAboutHealth1').text = "You said you have not been treated for hepatitis c before"
console.log("You said you have not been treated for hepatitis c before")
break;
default:
$w('#txtSummaryAboutHealth1').hide();
$w('#txtSummaryAboutHealth1').text = " ";
break;
}
Something is missing. Advice? Ideas?
Extra context
You can msg me for any screenshots or more info.





