Hello everybody,
I am trying to use Airtable as backend for a submit form in my project. However, I cannot seem to integrate it and I don’t know the problem. I am using npm Airtable.js and axios.
I am very new to both JS and Airtable.
Below is my error code:
Error in the browser after submiting the form:
Airtable error: {“error”:{“type”:“INVALID_REQUEST_MISSING_FIELDS”,“message”:“Could not find field “fields” in the request body”}}
Could somebody please what I am doing wrong? Thanks a lot in advance!
Below is my code:
var form = document.querySelector("#bize-ulasin");
if(form) {
form.addEventListener("submit", function(event) {
event.preventDefault();
axios.post(airtable_write_endpoint,
{
"Content-Type": "application/json"
} ,
{
"fields": {
"AdSoyad": document.getElementById("#Ad-Soyad"),
"Email": document.getElementById("#Email"),
"Telefon": document.getElementById("#Telefon"),
"Konu": document.getElementById("#Konu"),
"Mesaj": document.getElementById("#Mesaj"),
"Ortam": "Websitesi"
}
})
.then(function(response) {
console.log(response);
})
.catch(function(error) {
console.log(error);
})
})
};