Hi guys, already a week now trying to solve this, please help me!
I’m just trying to have the users update their profile pics with images they already uploaded.
I have a repeater containing the current profile pic and I have another repeater with the pics the user has uploaded. Both repeaters are connected to the same collection with 2 different datasets, one for each repeater. I would like the user to be able to select an image from their uploaded images to update the profile pic.
Here’s the code I’m trying, I got the code from an older post:
export function container2_click(event) {
$w(“#repeater6”).onItemReady(($item, itemData, index) => { let clickedItemData = $item(“#dataset4”).getCurrentItem();
$w(“#image9”).src = itemData.img;
});
}
container2 is holding the uploaded images inside #repeater6, this repeater and its elements are connected to #dataset4. #image9 is the current pic
Here’s the #error I’m getting:
-----Wix code SDK Warning: The src parameter of “image9” that is passed to the src method cannot be set to null or undefined-----
I saw this same error in an older post and it was solved but I couldn’t fix it anyway. I hope you guys can help me.
So, I replaced what I think it needed to be replaced in the code. Can you please check if I’m doing it right? I have very little experience in coding.
I’m getting an error script in setFieldVlaue line. What should I put there?
That #savebutton1 submits whatever is in the upload button, that’s done. The 3 images are the uploaded images where #firstImage is, all are #firstImage. I guess I can add another #savebutton2 to submit the change when using the uploaded images, put it in the same place but hidden and show it when one of the uploaded images is clicked, vice-versa if #uploadbutton1 > 0, not sure if this would be the best approach. How can I, first, show the user she/he has selected one of the uploaded images, like a highlighted border; second, submit the change with the #savebutton2.
Thanks for all your help. I would’ve never got it.
export function uploadedImageSave_click(event) {
$w(“#dataset3”).save()
.then((item) => {
$w(“#dataset3”).refresh();
})
. catch ((err) => { let errMsg = err;
});
}
The #imgUploadedSelect is shape element I put around #firstImage to show a selection, I have that hidden on load, but I don’t know how to switch from a clicked image to another.
I’m trying to show the user what image he has selected to replace the profile pic, so i put a border shape (#imgUploadedSelect) around the clicked image, i’m showing this border when the user clicks but when a different image is clicked, the border of the previous clicked image has to hide, i dont know how to do it.
Everything has worked, thank you for taking the time.
Now, #repeater6 shows 3 options to update the profile pic, the current pic is one of them, How can I not show the current image and instead show another pic available?
And one last thing (the cancel button), the profile pic is changed after an image has been selected and it is not submitted until #save is clicked, meaning that if I click cancel, the change is not submitted but the profile pic is changed, how do I make the cancel button revert the change and put back the current pic? Including removing the border(#imgUploadedSelect) that shows that an image is selected.
Here’s #dataset3, #repeater5 and it’s element (current profile pic) are connected to this #dataset3.
I hope this is what you mean by structure. The sort is date created New to Old
Of course not, you can connect any place holder (image, gallery) to a dataset. And in your case you should do it, and don’t use a repeater. Repeater is only for repeating elements.