I've made a simple form where the user fills in a form, but the Email is pre-filled by the $w code before. When I Publish the website I can see the email address has been filled in, however the value doesn't get submitted to the Collection.
If I remove the code "$w("#email").value = userEmail;" and just fill in the field manually, it works fine, but that's now how I need the site to be. Can anyone understand why pre-filled inputs aren't working?
user.getEmail()
.then( (email) => {
let userEmail = email;
$w("#email").value = userEmail;
} );
Thanks for the steer Shan. If I need to use the wixData.insert() function and provide an object with all the variables from my input fields, how do I provide the email address?
Using the example code in my initial post, I can't seem to use the variable userEmail outside of the then().
In your use case you need to use the Wix Data insert() API to insert the data into the database.