I am pulling the email of the person logged-in to place the email in a field of a database record along with selections from drop-downs. The problem I am having it the email is added sometimes but not all of the time. Below is the code for my page. I am new at coding so be gentle. Any help would be greatly appreciated
import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
let user = wixUsers.currentUser;
let userId = user.id;
let isLoggedIn = user.loggedIn;
user.getEmail()
.then( (email) => {
let userEmail = email;
$w(“#voteemail”).value = userEmail;
console.log(userEmail);
} );
$w.onReady(function () {
});
export function Start_click(event) {
//Add your code for this event here:
$w(‘#firstchoice’).enable();
}
export function firstchoice_click(event) {
//Add your code for this event here:
$w(‘#secondchoice’).enable();
}
export function secondchoice_click(event) {
//Add your code for this event here:
$w(‘#submitvote’).show();
}