I use Wix Editor, Dev mode. I have added the below code to an input field on a form which only logged in members can get to. It very nicely puts the email address into the email input field on the form, however, after the user submits the form, the email address does not populate the email field in the collection. Also, which bits do I edit in the code so that it will also insert the name? My collection has a text field of Name and the form has an input field called Name.
// Velo API Reference: Velo Docs
// Velo API Reference: Velo Docs
import wixUsers from ‘wix-users’;
// …
let user = wixUsers.currentUser;
let userId = user.id;
let isLoggedIn = user.loggedIn;
let userRole = user.role;
let username = user.name
user.getEmail()
.then( (email) => {
let userEmail = email; // “user@something.com”
$w(‘#input11’).value = userEmail;
}
);
Thank you