Hi so in my form for a recipe I have an image upload button that is connected to my dataset. I am manually inserting my recipe into my database so that I will be able to save the current user ID with it. but the problem is when I call .getCurrentItem() on my dataset it has all the information I entered except for the image key and value.
My code looks like this:
let user = wixUsers.currentUser;
let userId = user.id;
let recipeInfo = $w("#dataset1").getCurrentItem();
let fullRecipe = Object.assign({}, recipeInfo, {userId: userId});
wixData.insert('Recipes', fullRecipe)
When I log my recipeInfo to the console it has all the expected data from the form except for the image. Is this expected behavior? How would I be able to get the image information to save with my dataset? Thank you.
Hey Andreas I figured it out. Thanks for your help!
Hi Andreas no I do not. I didn’t know that was necessary. Do you have sample code or an example that I could follow for reference? Thank you so much!
Ok do you have code that uploads the image before saved? If you dont the image will be present after save.
{
abv: "1"
description:"description"
directions:"directions"
fg:"1"
ingredients:"ingredients"
name:"recipe"
og:"1"
url:""
_id:"5a389971-a481-46a6-a247-2b919d2676b1"
}
This is the result of the getCurrentItem() function when logged to the console. It has all the fields that I expect except for the uploaded image. Heres an image showing that it is connected to the recipe dataset.
Can you paste in the console.log results here please