Member email value in input field not inserting to dataset

Hello - I have a form with a dataset and linked input fields as well as a save button. When the form loads I place the current users email into an input box but when I select the Save button, the value in that input box (ProviderIDText) is not being inserted in the table. All other fields are saving except for this field which I called ProviderID. The input box is not read only and I see that it is displaying the email address on load but for some reason it is not making it into the dataset.

import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;

$w.onReady( function () {
let user = wixUsers.currentUser;
let userId = user.id; // “r5cme-6fem-485j-djre-4844c49”
let isLoggedIn = user.loggedIn; // true
user.getEmail()
.then( (email) => {
$w( “#ProviderIDText” ).value = email.toString(); // “user@something.com
//$w(“#SpacesDataset”).setFieldValue(“SpaceProviderID”, email);
})

$w( “#SpaceCountryDropDown” ).value = “US”
$w( “#StatusText” ).value = “Draft”
} );

https://www.wix.com/corvid/reference/$w/textinput/value

  • If an element is connected to a dataset, setting the element’s value in code does not set the value of the connected field in the dataset. That means if you use the dataset to perform a submit, the value changed in code is not reflected in the submitted item.

  • To submit the new value using a dataset, set the field’s value using the setFieldValue() function before performing the submit.

Thank you, I ended up relaying on the OwnerId field instead of inserting the current user email and that seems to be working.