I created one form with 5 fields. For 2 fields I am fetching data from collection1(using wixData.query( " collection1 " ) ) and set fields value via query result. Another 3 fields need input fields added by the user. all 5 fields connected with the dataset2.
When I submit the form, 2 fields(fetch from collection1) of data not save on collection2.
$w.onReady( function () {
let cdata = wixWindow.lightbox.getContext();
$w( “#email” ).value = cdata.email;
$w( “#cnumber” ).value = cdata._owner
$w( “#vacancyID” ).value = cdata.vacancyId
$w( “#applicationID” ).value = cdata._id
wixData.query( "Candidates" )
.eq( "_owner" , cdata._owner)
.find()
.then((results) => {
$w( "#fname" ).value = results.items[ 0 ].firstNam;
$w( "#lname" ).value = results.items[ 0 ].lastName;
})
});
I have the above code set on the ready function. I have form with a submit button connected to Collection2. but #fname and #lname fields do not save to the collection2 when I click on the submit button.
Any help, please?