Skip to content
Sign inJoin waitlist

Forms — Cerette HTML

The Cerette HTML template has one inquiry form, on three kinds of page (Contact, Services and every service page), and it sends to the form service or webhook of your choice.

The form checks the required fields, shows a spinner in its button while sending, then “Thank you” and clears the fields; it keeps what the visitor typed when something fails (“Something went wrong”), and drops spam with a hidden honeypot field.

Out of the box it runs in demo mode: nothing is sent, and the fields are logged in the browser console. Pick a destination before you publish.

A static site has no server of its own, so submissions go to a form service or a webhook. All of these have a free tier:

Service What it does formEndpoint
Formspree Emails you each submission https://formspree.io/f/<form id>
Web3Forms Emails you each submission, no account needed https://api.web3forms.com/submit, and your key in formAccessKey
Getform, Basin Inbox, email, integrations The form’s endpoint URL
Zapier, Make, n8n, Pipedream Send submissions anywhere: Google Sheets, Slack, a CRM, your project tool The webhook (“catch hook”) URL
  1. Create a form at the service and copy its endpoint.

  2. Open assets/js/config.js and paste it:

    window.siteConfig = {
    formEndpoint: "https://formspree.io/f/abcdwxyz",
    formAccessKey: "", // Web3Forms only
    };
  3. Serve the folder (npx serve .), send an inquiry from the Contact page and check that it arrived.

  4. Upload config.js with the site.

Every page loads the same config.js, so the three forms send to the same place; tell them apart by their form and subject fields (below). The sample forms in style-guide.html stay in demo mode whatever you set there (they carry data-form-demo), so they never send anything.

Each field by its name, as multipart/form-data:

Field Name Required Values
Name name
Email email
Phone phone
Location location
Project type type yes on Contact and Services One of Architecture, Construction, Interior, Planning, Renovation, Landscape. On a service page it is a text field that starts with the service’s name
Project budget budget yes Under $50K · $50K – $100K · $100K – $250K · $250K – $500K · $500K+
Project details details

The form also sends form and subject:

Page form subject
Contact, Services contact New inquiry from the Cerette website
A service page service New service inquiry from the Cerette website

With formAccessKey set, it also sends it as access_key. The honeypot field is left out. The request asks for a JSON answer (Accept: application/json), so the service answers the page instead of showing its own thank-you page.

The fields are ordinary <input>, <select> and <textarea> elements inside the <form data-form> of contact.html, service.html and each page in service/, each inside a <label> with its visible name (“Name”, “Email”…) and a placeholder (“Enter your full name”). From tablets up they sit two to a row, and Project details takes the whole width (md:col-span-2); phones show one column. The form is written into each of those pages, so change every copy.

  • To make a field required, add required to it. The browser checks it before sending. Only the selects are required in the demo; you will probably want required on Name and Email too.
  • To change a choice, edit its <option value="…">…</option>. Keep the first <option value="" disabled selected> of each select: it is the prompt (“Select project category”) that makes the visitor choose.
  • Project type on a service page is <input name="type" type="text" placeholder="Architecture" value="Architecture">: the visitor can change it, and the form puts the service’s name back after a send. Write your service’s name in both value and placeholder.
  • To add a field, copy a <label>…</label> with its <input …/>, give it a new name, label and placeholder. The service receives whatever the form contains, so there are no settings to update. Don’t name a field fax: it is the honeypot’s.
  • To remove a field, delete its <label>.

A field arrives under its name, so keep the names you already map somewhere. The button’s texts are written in the button: “Send Inquiry” twice (the second copy is read while the form is sending), “Thank you” and “Something went wrong”. “Thank you” and “Something went wrong” are also in the form’s data-success and data-error, which screen readers announce: change both. The title of each submission is the value of the hidden subject field: put your own name in it.

To send visitors to a page of your own after a successful send, add data-redirect="thank-you.html" to the <form>.

  • Send an inquiry from the live site with a real address, from Contact and from a service page, and reply to the test.
  • The service must answer with a success status (2xx). If it doesn’t, the visitor sees “Something went wrong” and keeps what they typed. Try it once by pasting a wrong endpoint into config.js on your local copy.
  • The browser console tells you what happened: in demo mode it logs [forms] demo mode — set formEndpoint in assets/js/config.js to send submissions with the fields; after a failure, [forms] could not send the form with the reason.

The honeypot stops the usual bots: the form carries a hidden field named fax that a person never sees; a bot that fills it is shown “Thank you” and nothing is sent. The services above filter spam on their side as well. The endpoint is visible in the page source, which is how these services are designed to work.

Submissions go only where you point them. Make sure your privacy policy says what happens to the data people send you (here a name, an e-mail address, a phone number, a location and the project details), and link it near the form if the law you work under asks for it (Editing the site).