I have done this in the past, but today I wanted to add some extra fields that I want them have as input data from the dataset, and I have noticed that the “Connect to Data” icon has dissapeared from options for a field in form from the editor.
This issue occurs just for fields in a form, if outside of the form I want to connect a text field to data, it works fine, as it has to.
Thanks in advance,
Isn’t there a way via code to get a field content from a Collection and set it into a form field value?
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). ?!
I have successfully reach to have as input of a field in a form a field from a collection. This are my corrections in the code (I have included the onReady function for the Dataset in the onReady function of the site and the use of a const for the value) :
import wixData from ‘wix-data’ ;
$w . onReady ( function () {
$w ( “#dynamicDataset” ). onReady ( () => {
let tipodecoche = $w ( “#dynamicDataset” ). getCurrentItem ();
const TIPOCOCHE = tipodecoche . tipoDeCoche ;
$w ( ‘#input1’ ). value = TIPOCOCHE ;
console . log ( TIPOCOCHE );
} );
});
Hope this helps someone with the same issue.