OK When the user is logged in you can use the wix-users api to get the user’s id.
Then all you need is a userId field in your data collection.
With this, assuming you are using a dataset for saving the form, all you should need to do is:
import wixUsers from 'wix-users';
$w.onReady(() => {
$w('#datasetname').onReady(() => {
if (wixUsers.currentuser.loggedIn) {
let userId = wixUsers.currentUser.id;
$w('#datasetname').setFieldValue('userId', userId);
}
}
});
