Hello all,
So I’m creating a custom form that uses code to capture a user’s inputs and put them into a database. The code all runs fine except when I go to check the database, all the custom fields are empty. Only the default fields like ID, Owner, etc. are filled in. Here’s the code:
let toInsert = {
"firstName": $w('#firstName').value,
"lastName": $w('#lastName').value,
"phoneNumber": $w('#phoneNumber').value,
"email": $w('#emailAddress').value,
"schoolName": $w('#schoolList').value,
"dateOfBirth": $w('#dateOfBirth').value,
"status": $w('#status').value,
"scienceProject": sp,
"highSchoolDebate": hsd,
"primarySchoolQuiz": psq,
"graphicCreativeArt": gca,
"category": "N/A",
"abstractSubmitted": false,
"abstractReviewed": false,
"needsResubmission": false,
"resubSubmitted": false,
"resubReviewed": false,
"complete": false,
"schoolCrest": crest,
"profilePic": "https://static.wixstatic.com/media/aa2f46_331fd51268b34d55a5faac1d4d34f2c7~mv2.png"
}
console.log("Information gathered; adding information to the 2023_Registration database")
wixData.insert("2023_Registration", toInsert, options)
.then( (results) => {
let item = results;
console.log("Information added. User is now registered in the 2023_Registration database with the following details " + toInsert)
})
.catch( (err) => {
let errorMsg = err
})
Of course I use the import wixdata etc. at the start of the code.
Any help would be greatly appreciated.