I’ve created a custom form on a slideshow with a “Back” and “Next” button.
“Back” returns users to previous questions and “Next” button sends users to following questions.
My custom form has a datepicker and when users selects a date, continues with form and later returns to datepicker (if they wish to change the date), the value disappears.
This is a bug in the wix platform. To get around it create a function that captures the selected date and then each time the user presses the back button on your slideshow run the function to set the date automatically to the previous captured date. Something like this…
function preventDateFromResetting() { let stopWixGlitch = $w(“#datePicker1”).value;
$w(“#datePicker1”).value = stopWixGlitch;
}
//after date has been set run the function
preventDateFromResetting()
//run the function when the back buitton is pressed also
$w(‘#backButton’).onClick( function () {
$w(‘#slideshow1’).changeSlide(0);
preventDateFromResetting()
})
@callumsaffet it should work (I’ve updated the code above because the element selector was “#datePicker1” instead of “#datePicker”). Make sure you’re using the right property ID’s.
Select a date box = #datePicker3 Next button = #button5
The following appears in preview mode after I select a datepicker value, select the Next button, then select the Back button to return to the question.
@callumsaffet I can’t tell you what’s going wrong. I’ve tested the code and didn’t get any error.
But I can see that you’re using more than one $w.onReady() on the same page, and I think you better use one for the entire page, and put everything inside it (but that’s probably not the issue).
@callumsaffet This is not descriptive enough. What’s exactly happening? Is it disabled? Is it not click-able? Do you see any error in the console? what’s the code for these buttons?