Read only form field not populating database

I have a simple form


The email address is an user input field which is read only, that information comes from wixUsers.currentUser like so:
wixUsers.currentUser.getEmail()
.then( (email) => {
$w(“#input3”).value = email;
} );
The other 2 user input fields are where the user has to input text information.
On clicking the “Button”, the database gets populated with the ‘Art Title’ and ‘Description’ fields but not the email field.
If I remove the ‘read only’ from the general setting of the email field and let the user input some value, then the database gets populated.

Please help.
This is a workaround for reference fields not getting auto populated.

Please help. Sometimes the read only field gets added and sometime it doesn’t.
I added 2 read only fields, one for email and another for userId. The userId field gets added more often than the email read only. What is the issue?


Here’s the code:
import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;

$w.onReady( () => {
let user = wixUsers.currentUser;
if(user.loggedIn) {
user.getEmail()
.then( (email) => {
$w(“#input3”).value = email;
$w(“#button2”).label = “Logout”;
$w(“#button3”).show();
$w(“#input6”).value = user.id;
} );
//$w(“#group1”).show();
}
else {
$w(“#button2”).label = “Login”;

$w("#button3").hide(); 
//$w("#group1").hide(); 

}
} );

export function button2_click() {
// user is logged in
if(wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w(“#button1”).label = “Login”;
$w(“#button2”).hide();
} );
}
// user is logged out
else {
let userId;
let userEmail;

// prompt the user to log in  
wixUsers.promptLogin( {"mode": "login"} ) 
  .then( (user) => { 
    userId = user.id; 
    return user.getEmail(); 
  } ) 
  .then( (email) => { 
    // check if there is an item for the user in the collection 
    userEmail = email; 
    return wixData.query("Members") 
      .eq("_id", userId) 
      .find(); 
  } ) 
  .then( (results) => { 
    // if an item for the user is not found 
    if (results.items.length === 0) { 
      // create an item 
      const toInsert = { 
        "_id": userId, 
        "email": userEmail 
      }; 
      // add the item to the collection 
      wixData.insert("Members", toInsert) 
        .catch( (err) => { 
          console.log(err); 
        } ); 
    } 
    // update buttons accordingly 
    $w("#button2").label = "Logout"; 
    $w("#button3").show(); 
    $w("#input3").value = userEmail; 
    $w("#input6").value = userId; 
    //$w("#group1").show(); 
   
  } ) 
  .catch( (err) => { 
    console.log(err); 
  } ); 

}
}

export function button3_click() {
wixLocation.to(/Members/${wixUsers.currentUser.id});
}

Please help!