Ok, then look here at this code. It’s a very simple one.
What you will need to reconstruct?
- 1x dropdown
- 1x image
- 1x-Dataset for the MATERIAL-LIST (“dataset1”)
- 1x DATABASE called “Materials”, where you store all the materials and it’s names.
- “dataset1” connected to your “Materials”-Database .
- “dropdown1” connected with “dataset1” ( read&write )
Reference-Field (“title”): —> Material-Names
Reference-Field (“image”): —> related images
$w.onReady(function () {
wixData.query("Materials").find()
.then( (results) => {
if(results.items.length > 0) {
myResults = results.items
} else {
// handle case where no matching items found
}
} )
.catch( (err) => {
let errorMsg = err;
} );
$w('#dropdown1').onChange(()=>{
$w('#image1').src=myResults[$w('#dropdown1').selectedIndex].image
})
});
And here a little example 4-you…
https://www.media-junkie.com/image-list