From 72b918ab4ef347fe3a45a597390520b5bbd70701 Mon Sep 17 00:00:00 2001 From: Dyl Bromell Date: Thu, 20 Jun 2019 20:20:57 +0200 Subject: [PATCH] docs(www): add Build a Contact Form reference guide (#14564) (#14768) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Docs: add Build a Contact Form reference guide (#14564) Adds a reference guide for building contact forms in Gatsby! Has sections regarding: - Adding a Contact Form - Creating an Accessible Form - Sending Form Data - with Netlify - with Formspree - Running Your Own Server - Other Resources (a cool Scott Tolinski tutorial) * Adds a reference guide for building contact forms in Gatsby! Has sections regarding: - Adding a Contact Form - Creating an Accessible Form - Sending Form Data - with Netlify - with Formspree - Running Your Own Server - Other Resources (a cool Scott Tolinski tutorial) This time, actually includes reference guide! ✨ * Adds fixes for all aforementioned proposed changes, including: - Removes `Adding a Contact Form` Heading - Fixes link to `Adding Forms` - Fixes `Run your own server` case - diffs netlify code example, as requested - adds link to netlify form-handling doc - adds reference to formspree honeypot for spam prevention (good catch @marcysutton!) * Adds subheading to gracefully transition between sections Adds subheading to indicate transition between conceptual form example and practical how-to's --- docs/docs/building-a-contact-form.md | 150 +++++++++++++++++++++++++++ www/src/data/sidebars/doc-links.yaml | 2 + 2 files changed, 152 insertions(+) create mode 100644 docs/docs/building-a-contact-form.md diff --git a/docs/docs/building-a-contact-form.md b/docs/docs/building-a-contact-form.md new file mode 100644 index 0000000000000..20ab8fbe5deac --- /dev/null +++ b/docs/docs/building-a-contact-form.md @@ -0,0 +1,150 @@ +--- +title: Building a Contact Form +--- + +This guide covers how to create a contact form in a Gatsby site, along with an overview of some strategies for handling form data that has been submitted. + +Gatsby is built on top of React. So anything that is possible with a React form is possible in Gatsby. Additional details about how to add forms to gatsby can be found in the [Adding Forms](/docs/adding-forms/) section. + +## Creating an Accessible Form + +Faulty forms are a common barrier to a website's accessibility, and can be especially problematic if you use a keyboard and screen reader to navigate the web. Forms should be clearly and intuitively organized into groups of related information, and each form field should be identified with a proper label. + +More information on creating accessible forms can be found in [WebAIM's article](https://webaim.org/techniques/forms/) on the subject. + +## Sending Form Data + +When you submit a form, the corresponding data is typically sent to a server to be handled in some manner. More in-depth information on sending form data can be found [on MDN](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Sending_and_retrieving_form_data). + +Each method detailed below will start with the following contact form: + +```jsx:title=src/pages/contact.js +
+ + + +