The autofill does not appear in the dataset.

Morning, I created a multistate form that collects company and business information from the visitor. In the first state, the visitor would enter the company name which is stored in a main dataset. In the third state, the visitor would enter the owners of the business which would be saved in a secondary dataset which is to be linked to the main dataset via the company name. I want to have the input box for the company name in the third-state autofill from the input box from the first state. I wrote the code below, the company name appears in the input box but does not update to the dataset, even though the other data does. I just need that the autofill update to the dataset.

Here is the simple code I wrote:
$w . onReady ( function (){
$w ( ‘#input1’ ). onChange (( event ) => {
$w ( ‘#input66’ ). value = $w ( ‘#input1’ ). value ;
});

$w ( ‘#button15’ ). onClick (() => {
$w ( ‘#input66’ ). value = $w ( ‘#input1’ ). value ;
});
});

Hi! Try out:

$w.onReady(function(){
  $w('#input1').onChange((event) => {
    $w('#input66').value = $w('#input1').value;

    let companyName = $w('#input1').value;
    wixData.update("secondaryDataset", { "_id": companyName }, { "companyName": companyName }).then((results) => {
      console.log("Successfully updated the dataset!");
    }).catch((error) => {
      console.log("An error occurred: " + error);
    });
  });

  $w('#button15').onClick(() => {
    $w('#input66').value = $w('#input1').value;

    let companyName = $w('#input1').value;
    wixData.update("secondaryDataset", { "_id": companyName }, { "companyName": companyName }).then((results) => {
      console.log("Successfully updated the dataset!");
    }).catch((error) => {
      console.log("An error occurred: " + error);
    });
  });
});

Pay attention when working with datasets and wix-data-api in a mixed mode :wink:
You do not know if the post-opener is using the PROPERTY-PANEL.
Mixed mode can cause problems.

Thanks a lot