I have a function that is triggered by a form submission with submission-created. I want to access the form fields submitted in the function, but cannot see how to access them.
I submit the form using the following:
fetch("/", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: encode({ "form-name": "telephone", phonenumber: phoneNumber }),
})
I then try and access the phonenumber field like so:
const params = querystring.parse(event.body)
const telephone = params.phonenumber || “Not Set”
The above returns ‘Not Set’ and I cannot see any other way to access the data. Any points would be useful.