Connecting form fields input to Dataset

I have tried using code to get a value from an specific field of the dataset and load it as value of the form field, it works in preview mode but not in published version of my website. (it is a dynamic page with a dataset)

this is the code:

import wixData from ‘wix-data’ ;
$w . onReady ( function () {
});

$w ( “#dynamicDataset” ). onReady ( () => {
let tipodecoche = $w ( “#dynamicDataset” ). getCurrentItem ();
$w ( ‘#input1’ ). value = tipodecoche . tipoDeCoche ;

} );

thanks in advance.
Any idea of why we cannot connect data in wix forms anymore using the editor? (the option has dissapeared but I still have some fields that I succesfully connected in the past that are still connected and working). ?!