Forms — Brickfolio HTML
Brickfolio’s HTML edition has two forms, the contact form on Home (“Let’s Connect”) and the newsletter box in the footer of every page, and both post to any form service or webhook you choose.
Both check their fields in the browser (the first empty or wrong one gets the focus), show a spinner on the button while sending, then “Thank you” or “Something went wrong”, and drop spam with a hidden honeypot field. On success the fields are cleared; on an error the contact form keeps what the visitor typed.
Out of the box they run in demo mode: nothing is sent, the button shows “Thank you” and the fields are logged in the browser console. Pick a destination before launch.
Connecting a service
Section titled “Connecting a service”Put the service’s endpoint in assets/js/config.js:
window.siteConfig = { formEndpoint: "https://formspree.io/f/your-form-id", formAccessKey: "", // Web3Forms only};| Service | formEndpoint |
Notes |
|---|---|---|
| Formspree | https://formspree.io/f/<form id> |
Emails you each submission. |
| Web3Forms | https://api.web3forms.com/submit |
Also set formAccessKey (sent as the hidden field access_key). |
| Getform, Basin | The form’s endpoint URL | |
| Zapier, Make, n8n, Pipedream | The webhook (“catch hook”) URL | Route submissions anywhere: your inbox, Mailchimp, Google Sheets, Slack, a CRM. |
Every page loads config.js, so one setting covers both forms on every page. The forms post multipart/form-data with
Accept: application/json; the service must answer with a 2xx status, anything else shows “Something went wrong”. The
endpoint is public (it is in the page), which is how these services are designed to work; they filter spam on their side.
The forms need a host or a local server (npx serve .): opened straight from disk, the browser may refuse to send.
What the forms send
Section titled “What the forms send”The contact form (form: contact, subject: “New message from the contact form”):
| Field | Name it arrives under | Required |
|---|---|---|
| First name | First Name |
yes |
| Last name | Last Name |
yes |
Email |
yes, and it must look like an e-mail address | |
| Phone number | Phone Number |
yes |
| Message | Message |
no |
The newsletter box (form: newsletter, subject: “New newsletter subscriber”):
| Field | Name it arrives under | Required |
|---|---|---|
| E-mail (placeholder “Enter your email”) | Email |
yes, and it must look like an e-mail address |
Both post to the same endpoint; form tells them apart, and subject becomes the email’s subject at the services that
email you. To send the two forms to different places, use a webhook (Zapier, Make, n8n) that routes on form.
Changing the forms
Section titled “Changing the forms”The contact form is the <form data-form …> in the Let’s Connect section of index.html. Each field is a
<label data-field="…"> holding its text and an <input> (a <textarea> for the message); the input’s name is what
arrives at the service, and required makes it mandatory. To add a field, copy a whole <label>, and give it a new
data-field, name and text; to make one optional, remove its required. The button’s label (“Send message”) and its
two messages (“Thank you”, “Something went wrong”) are written in the button’s spans (the label twice: once for screen
readers while sending) and in data-success / data-error on the <form>: change both.
The newsletter box is the <form data-newsletter …> in the footer of every page: its title (“Subscribe to Our
Newsletter”), its text, the placeholder (“Enter your email”) and the button (“Subscribe”) change with find and replace in
files.
Keep the hidden fields (form, subject, and fax, the honeypot).
Testing before launch
Section titled “Testing before launch”- Send the contact form and sign up from your own site after uploading, with a real address.
- Check the destination (inbox, spreadsheet, audience).
- Try a failure on purpose: set a wrong
formEndpoint, submit, and confirm the button says “Something went wrong” and the contact form still holds what was typed.
The honeypot stops the usual bots: each 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. Formspree, Web3Forms and Basin filter spam too.
Privacy
Section titled “Privacy”Messages and sign-ups go only to the service you set; nothing is sent anywhere else. The forms collect names, e-mail addresses and phone numbers: say what happens to them in your privacy policy, and choose a service that keeps the data where the law where you work allows. The template has no privacy page and no consent checkbox: add them if your visitors’ country requires it (Editing the site).