Input Dropdown Not Required:
import wixLocation from 'wix-location';
$w.onReady(function () {
const btn = $w('#submitBtn');
btn.onClick(() => {
const dropdownValue = $w('#dropdown1').value;
if( dropdownValue == "Page 1") {
wixLocation.to("/page-1")
} else if (dropdownValue == "Page 2") {
wixLocation.to("/page-2")
} else {
$w('#thankstext').show();
}
})
});
Input Dropdown Required:
import wixLocation from 'wix-location';
$w.onReady(function () {
const btn = $w('#submitBtn');
const dropdown = $w('#dropdown1');
dropdown.onChange(() => {
btn.enable();
})
btn.onClick(() => {
const dropdownValue = $w('#dropdown1').value;
if( dropdownValue == "Page 1") {
wixLocation.to("/page-1")
} else if (dropdownValue == "Page 2") {
wixLocation.to("/page-2")
} else {
$w('#thankstext').show();
}
})
});
If you have more than 2 pages to link to, create copies of the code below for the amount of pages you are linking to:
else if (dropdownValue == "Page 2") {
wixLocation.to("/page-2")
}