submit button won't work correctly after publish

hey everyone!

i’m trying to save the current user email to my collection using a read-only inputText.
this is the code for getting the user mail.

if(user.loggedIn){
email = await user.getEmail(); 
}
$w("#input2").value = email;

The input2 textbox is connected to the email field in the collection.

in preview mode in the editor everything works just fine, while after publish i’m only getting empty fields instead of email.

a link to the page:

https://www.givigy.com/submissions

If you are using a user input element as a field, then it requires something to be adding to it by the user before it will save any changes in it, doing it through code won’t change it.