Hi all, I have a form with a number of dropdown inputs. By default only one drop-down is enabled. The page is coded so that after you select an option from a dropdown, the next dropdown options are populated from a wix query, then when you select the next option, another dropdown is populated and enabled, and so on.
Everything is working as I would like, but during testing I have noticed that if I refresh the page I don’t seem to be able to disable some of the dropdown inputs! :-/
I’ve tried putting some code in the onReady function and whereas I can hide one of the dropdowns in question, disable() does not seem to work.
Basically, if the page is refreshed I want to go back to as if the page was fully re-loaded.
Example of extra code in onReady() to try and force the state.
I don’t see a way to simulate page refreshes in the Preview, so I wondered if it was to do with onReady being called by the backend and the frontend, but the check in my code doesn’t seem to make any difference.
I think it is to do with browser behaviour, because a Ctrl+F5 works as expected. Is there a way to detect a refresh event and force a full client-side refresh?
Thanks in advance.
tl;dr: ONLY #dropdownProduct should be enabled when the page loads, but if I refresh while #dropdownBrand is enabled, I can’t disable it - it stays enabled after the refresh.
$w.onReady( function () {
if (wixWindow.rendering.env === “browser” )
{
datasetName = “ProductTypes” ;
$w( “#dropdownProduct” ).value = undefined;
$w( “#dropdownProduct” ).options = [];
populateUniqueDropDown( “Products” , “#dropdownProduct” );
$w( "#dropdownBrand" ).value = undefined;
$w( "#dropdownBrand" ).options = [];
$w( "#dropdownBrand" ).disable();
$w( "#dropdownModel" ).value = undefined;
$w( "#dropdownModel" ).options = [];
$w( "#dropdownModel" ).disable();
}
});