Hey, I have an question, it would be very Kind if someone could help.
I want to illustrate 4 pictures and if the user clicks one, I want to save the answer in the database. Is this possible?
Thank you!
Hey, I have an question, it would be very Kind if someone could help.
I want to illustrate 4 pictures and if the user clicks one, I want to save the answer in the database. Is this possible?
Thank you!
Yes, very simple. You can add an onClick to the image and write the following code -
import wixData from "wix-data"
$w("#image").onClick(()=> {
let imageSrc = $w("#image").src
let toSave = {
image: imageSrc //what currently says image should match the field key in the db
}
wixData.save("DBNAME", toSave)
})
Let me know if this helps.
Here are some helpful links
wixData save()
image src
Thank you! I will try it