I have had serious trouble trying to connect a button to another page via code. I wanted to connect a button to a progress bar, and every time a member presses the button the progress bar would go up by +5. I figured that part out, however, when I linked the button to another page, the new page would never get redirected, as the +5 would be. I was confused about why until I saw that my code wasn’t right. I want to figure out how to connect a button to another page via code. Below is the code I had originally.
import wixLocation from “wix-location” ;
$w.onReady( function () {
});
export function button1_click(event, $w) {
$w( “#progressBar2” ).value = + 5
wixLocation.to( “/page” );
console.log( "page" );
}
Can someone please help me?
To do this with the progress bar.
https://support.wix.com/en/article/corvid-working-with-the-progress-bar-element
https://www.wix.com/corvid/reference/$w.ProgressBar.html
You can simply make use of Wix Storage and store the value of the progress bar before you move the user onto the next page and then get it again when the next page loads to set the progress bar again with that value.
https://www.wix.com/corvid/reference/wix-storage.html
You can read this previous forum post about adding one on button click
Increment Button with 1
If you are wanting to do it for all users then you would have to do it slightly different and use a datahook, as shown in this post here .
Hello, Thank you for getting back to me.
I was wondering what the code was for the button so that I can move on to the next page. For instance, let’s say I wanted to move to a page called Sanay, and I was on a page called Vanay, what is the code that would move me to the next to Sanay. I do not want to move the progress bar, as I want to move the user, such as me. Basically, I want to be able to go to the next page, but it doesn’t let me with the other even listener.