[UNRESOLVED BUT CLOSED] Setting image.src causes error requesting string value

OK, so I’ve created an onChange event handler for my page and connected it to a dropdown. When a user selects an item from the dropdown, an image next to the dropdown is supposed to change based on their selection. The problem is that the image maintains its default and I get the following error in the console:
Wix code SDK error: The src parameter that is passed to the src method cannot be set to the value [object Object]. It must be of type string.

Here’s the code for the onChange event; the bottom section in bold italics specifically:
export function dropdown1_change(event, $w) {
let selectedSchool = $w(‘#dropdown1’).value;
wixData.query(“2020_Registration”)
.find()
.then( (results) => {
studentData = results.items;
const dropdownFilter = studentData.filter( function (dropdown) {
return dropdown.status === “Student” && dropdown.schoolName === selectedSchool;
})
console.log(dropdownFilter)
$w(‘#repeater1’).data = dropdownFilter;
})
. catch ( (err) => {
let errorMsg = err
})
wixData.query(“schoolCrests”)
.find()
.then( (res) => {
crestData = res.items;
const dropdownFilterCrests = crestData.filter(function(dropdownCrests) {
return dropdownCrests.schoolName === selectedSchool;
})
console.log(dropdownFilterCrests);
if(dropdownFilterCrests === null || dropdownFilterCrests === undefined) {
$w(‘#image4’).src = “https://static.wixstatic.com/media/aa2f46_b4aaf1740f9a47ee8c801c135f9524e0~mv2.jpg”;
}
else{
$w(‘#image4’).src = dropdownFilterCrests
}
})
}
Interestingly, the first part of the above code sets the data for a repeater which contains an image that loads properly without error. Also, on page load I use the below code for the same image4 and get no problems and no errors:
$w.onReady(function() {
wixData.query(“schoolCrests”)
.find()
.then( (res) => {
crestData = res.items;
if (crestData.crest === null || crestData.crest === undefined) {
$w(‘#image4’).src = “https://static.wixstatic.com/media/aa2f46_b4aaf1740f9a47ee8c801c135f9524e0~mv2.jpg”;
}
else {
$w(‘#image4’).src = crestData.crest;
}
console.log(“loaded school crest to associated image”);
})
. catch ( (err) => {
let errorMsg = err
})
})

Any ideas?

Just wondering if anyone can help with this. I’m still getting the same error.

So, looks like no one was able to or willing to help me with this and I’ve now gone a different route entirely. I know the mods have a lot to go through on a daily basis, but it’s always disappointing when you get no response at all. Even an inquiry for more details or something to acknowledge that your post was noticed.

Anyhow, for those interested; I never found a solution to the problem but I circumvented it by creating a repeater that only held a single image and set the image to display results based on the filtered database (look at the first part of the code to get an idea).