Hey, i am trying to add items in a form to a collection but evry time it just gives me empty field in the console and my collection, i have checked the id names of the collection and elements no problem in there, heres the code
import wixData from 'wix-data';
import wixLocationFrontend from 'wix-location-frontend';
$w.onReady(function () {
$w('#loginDetailsTxt').text = "Please enter these details before continuing";
$w('#errorMsg').text = "Field empty/wrong format";
const insertObj = {
"fullName": $w("#nameInput").value,
"title1": $w("#emailInput").value
};
//,$w('#nameInput').value,$w('#checkbox1').value$w('#emailInput').value
$w('#loginBtn').onClick(() => {
if ($w('#emailInput').valid === true && $w('#nameInput').valid === true) {
wixData.insert("ChakraLogindetails", insertObj)
.then((item) => {
console.log(item);
})
.catch((error) => {
console.log(error);
})
//wixLocationFrontend.to("https://www.isolvelife.com/chakra-cards");
}
else {
$w('#errorMsg').show('fade');
}
});
});
heres the console view:
fullName: ""
title1: ""
_id: "0dbf012c-729e-4bc9-af0f-f45cd15e4b37"
_owner: "ecd527f0-d2a0-4633-baf4-9777b5e0ffcc"
_createdDate: "Tue Jun 27 2023 03:37:17 GMT+0530 (India Standard Time)"
_updatedDate: "Tue Jun 27 2023 03:37:17 GMT+0530 (India Standard Time)"
as you can see the fullname and title1 field is empty
i have console logged the elements value and it is coming properly but as soon as i assign it to an object i start getting the the above.
Any help would be appriciated
Hi Kirtan, Thanks for sharing. Do you have a link to the live version of this page?
Any supporting screenshots would also be helpful.
Best,
Eitan