When I first started working with Netlify serverless events and forms, I discovered that Netlify “did stuff” with the form (Customized Form Handling on Netlify with Serverless Functions) in terms of modifying fields, adding additional information, and so forth. This is still not documented yet so I thought I’d start a thread to see if I can get firm answers on stuff.
I started with a form that had 3 fields: name, email, and comments. On submit, I see that the data comes out like so:
{
"number": 6,
"title": "Raymond Camden",
"email": "raymondcamden+dloct6A@gmail.com",
"name": "Raymond Camden",
"first_name": "Raymond",
"last_name": "Camden",
"company": null,
"summary": "<strong>Raymond Camden</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc,...",
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult",
"data": {
"name": "Raymond Camden",
"email": "raymondcamden+dloct6A@gmail.com",
"comments": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult",
"ip": "76.72.14.182",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 Edg/86.0.622.38",
"referrer": "https://netlifydemos.netlify.app/form7.html"
},
"created_at": "2020-10-13T14:02:06.088Z",
"human_fields": {
"Name:": "Raymond Camden",
"Email:": "raymondcamden+dloct6A@gmail.com",
"Comments:": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult"
},
"ordered_human_fields": [
{
"title": "Name:",
"name": "name",
"value": "Raymond Camden"
},
{
"title": "Email:",
"name": "email",
"value": "raymondcamden+dloct6A@gmail.com"
},
{
"title": "Comments:",
"name": "comments",
"value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sapien nunc, sagittis eget tincidunt in, convallis et erat. Nulla ult"
}
],
"id": "5f85b35e6db7f01b44b2db7a",
"form_id": "5f85aede3fd53200087dcf38",
"site_url": "http://netlifydemos.netlify.app",
"form_name": "Contact Form 7"
}
I’d like to talk about the above information.
number
- This appears to be the form submission number, ie the 6th form posted. Can you confirm?
title
- this is the same value as name
- what is the purpose of this?
email
- this is the email field - why is it at the top of the data?
company
- I assume it’s trying to match something in my form and failing. What rules are applied here, and the above? Will it only match a field called company? Will title only match name, or will it attempt to match something else too?
name
- ditto for above - so if the logic “I look for common fields and float them to the top for easy access”?
first_name
and last_name
seem to just do a split on input. When I entered Raymond John Camden, it dropped the John. When I did “Raymond St. Claire”, it reported the last_name as Claire.
summary
- the name, in bold, and a portion of the comments field. Again, what is the logic for making this? It looks like a good summary, but I’d like to know.
body
- just the comments field. Why?
data
- the original form, except that ip, user_agent, and referrer, are added by you. And here’s the thing. If I have a form field named ip (imagine I’m asking lawyers if they work with intellectual property law), that field is not available, anywhere. It just gets overwritten. Not a big deal… if documented.
human_fields
and ordered_human_fields
what is the point of this? It looks to be just capitalizing my fields, but maybe it does more? I just tested with contact_phone_number and it changed it to Contact Phone Number, so I guess it’s capitalize each word?
I think the rest makes sense - but to be sure, is id
the ID of the individual form submission?