Skip to content

Contact Form

You'll put a contact form on your static site that lands in your inbox, with real labels, a spam trap and a thank-you page.

About

You don't need a server to receive a message. A form endpoint service takes the POST and emails it to you, and Netlify Forms, Formspree, Web3Forms and others have free tiers that cover a personal site forever. The hard part isn't the form itself. It's the labels, the spam, and the thank-you page, which is why the badge spends most of its time there.

At a glance

Per requirement
25 XP
Completion bonus
150 XP
Requirements
5
Takes
One weekend
Skill level
Beginner (done it a few times)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
With other people
Locked for now
Earn two more Common badges in Web Building to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Write the form with real labels on every field. You need name, email, message and a submit button. Every input gets a label element with a for attribute, not a placeholder standing in for one, and required fields get the required attribute. Take a screenshot of the markup. Photo
  2. 2
    Point it at a form endpoint and send yourself a test. Sign up for a free form service and set the form's action attribute to the URL they give you. Fill in the form on your live site, submit it, and open the email. Take a screenshot of the email in your inbox. Photo
  3. 3
    Add a honeypot field to catch bots. A honeypot is a hidden text input that humans never see and bots fill in, and most services reject any message where it's filled. Hide it with CSS rather than type=hidden, because bots skip hidden inputs. Take a screenshot of the field in the markup and its CSS. Photo
  4. 4
    Build a thank-you page and redirect to it. Make a page that says the message arrived and when you'll reply. Set the redirect in the form service's settings or with a hidden _next field. Film yourself submitting the form and landing on the thank-you page. Video
  5. 5
    Have three people send you a message through it. Use real people on their own devices, and ask one of them to do it from their phone only. Fix whatever confused them. Take a screenshot of the three messages in your inbox. Photo