Hi Daniel ![]()
I’m not sure I quite understand why the value returned by the dataset isn’t the correct one, are the dropdowns populated manually, by code or by a dataset?
As far as I can tell, you’re populating them manually, so make sure the values of the dropdown are the same as its labels. (label: junior, value: junior) and not (label: junior, value: item1).
You need to create an onChange() event handler to redirect the visitors to the relevant page.
// Create the event handler
$w('#dropdown1, #dropdown2).onChange((event) => {
let year = $w("#dropdown2").value;
let age = $w("# dropdown1").value;
$w("#button1").link = `/players/${age}/${year}`;
})
This will update the link of your button whenever you change the value of the dropdowns.
You can also redirect visitors immediately like this:
import wixLocation from 'wix-location';
$w('#dropdown1, #dropdown2).onChange((event) => {
let year = $w("#dropdown2").value;
let age = $w("# dropdown1").value;
wixLocation.to(`/players/${age}/${year}`);
})
Hope this helps~!
Ahmad