On submitting fields don't get copied to collection

Good day all.

I have this form, the yellow part of which is automatically populated by the code below upon entering the client’s email address. The rest of the form in inputed manually.

Code to pull form data from Collections:

import wixData from 'wix-data';
import wixUsers from 'wix-users';
import {customFieldsFunction} from 'backend/customFields';

export function inputLoginEmail1_change(event) {
 let client1 = $w('#inputLoginEmail1').value;
        .eq('loginEmail', client1)
         if (results.items.length === 0) {
         } else {
                 let items=results.items;
                 let FN = items[0].firstName;
                 let LN = items[0].lastName;
                 let userID = items[0]._id;
                .then((customFields) => {
                   let DoB = customFields.Birthdate;
                   let CoB = customFields.Birthplace;
                   let Referral = customFields.Referral;
                   let Gender = customFields.Gender;
                   let Phone = customFields.phones.toString();
                   let CoR = customFields.Residence;
                    $w('#inputDoB').value = DoB;
                    $w('#inputCoB').value = CoB;
                    $w('#inputCoResidence').value = CoR;
                    $w('#inputGender').value = Gender;
                    $w('#inputReferred').value = Referral;
                    $w('#inputPhone').value = Phone;
                $w('#inputFN').value = FN;
                $w('#inputLN').value = LN;

The problem I am facing is that on submitting the form, none of the fields in the yellow box above are inputted to the Collection.

I found two workarounds so far, but neither seems like the ideal solution.

I notice that if I tab into the automatically populated fields and I then add a space after the last text character, that field does actually get inputted to the collection correctly.

I coded my way around on another form where I had the exact same problem by:

  1. creating onClick function

  2. using onAfterSave

  3. retrieving the ID of the newly submitted entry

  4. updating it with the values of the fields in the yellow box in the above screenshot

here is the code I used in the other form:

export function button7_click(event) {
    $w("#datasetIntake").onAfterSave( () => {
         let userId = wixUsers.currentUser.id;
         getItemID (userId)
        .then((results) => {
            let items = results.items[0];
            let itemId = items._id;
                let oggetti = item;
                oggetti.email = $w('#textEmail').text;
                oggetti.firstName = $w('#textFN').text;
                oggetti.lastName = $w('#textLN').text;

This second work around works well, but I thought that using the standard Submit function on the Editor, coupled with a custom onClick function in the code can cause issues.

And in any case it seems like a waste of time to use these workarounds if indeed the automatically populated fields are also supposed to be inputted to the collection upon submitting the form.

Any suggestions please?

Any comments please?

Anyone from the Wix team care to comment?
It’d be useful to know