I have a collection set up that I would like to be able to query and edit. One of the fields is an image. Right now I run the query and then have set the input values based on the results of the query, $w("#emailInput").value = results.email; for example. When i try to use, $w("#userPhoto").src = results.photo; it doesn't show the image from the data collection. It still shows the default image. What am I missing?
Thanks.
Thanks for the reply....
I'll include all the code below. There is some unnecessary code, since I've been trying to troubleshoot this, but the $w("#image4").src = currentimg; is the piece that's not working. #input22 and #inuput23 fill in appropriately. And I verified that photo in Item_Entries is an image, not a media collection.
let newItemQuery = wixData.query("Item_Entries");
newItemQuery = newItemQuery.isEmpty("accepted"); newItemQuery.find() .then( (results) => { let firstItem = results.items[1]; $w("#myTable1").rows = results.items; let desc = firstItem.description; let email1 = firstItem.email; let currentimg = firstItem.photo; console.log(currentimg); $w("#text20").text = desc; $w("#image4").src = currentimg; $w("#input23").value = email1; $w("#input22").value = desc; } );
Please share all your code where you get the results so I can see the whole picture.
If results is in your query as the query result you must do it like this
$w("#userPhoto").src = results.items[0].photo;
That will take the first record back from query results items.
If that is not the case that results is the query result are you really sure that the field type photo is an Image field type and not Media Gallery?