So I am creating a contact form on my website and I am trying to add the data to my data collection via wix code.
When I insert into the database with hard coded strings it works but when I try to insert with references to text fields this does not work? They show up blank??
Your code generally speaking has all the right elements, but not necessarily in the correct order…
I would suggest that you move the ‘toInsert’ object inside the submit button’s onClick. Then, for each of your keys inside the ‘toInsert’ object, I would add the input element instead of the variable declared, for instance…:
let toInsert = {
"emailAddress": $w("#EmailAddress").value,
"name": $w("#fullName").value
}
Please share your solution with us and edit your post title to include (Solved). For coding newbies like myself, it’s been extremely difficult to figure out how to code. I actually spend hours and hours trying to find solutions that worked for other people, then attempt to tweak their code for my own situation. It’s been a very frustrating journey because what may be simple to some people, I am completely clueless about. Im presently trying to figure out a solution to a current dilemma and I think your code could help point in my the right direction. Thank you in advance and I hope you see this (I know this post is old)