Forms — Fitbricks HTML
The Fitbricks HTML template has three forms, and they send to the form service or webhook of your choice: the contact form, the free-trial form and the booking form of every club.
“Get in Touch” is on Contact, “Claim Free Trial” on Free Trial, and “Book Your Class Now” in the sidebar of each of the 30 club pages. Each form checks its fields in the browser, shows a spinner on its button while sending, says “Thank you” on the button and clears the fields, keeps what the visitor typed when something fails (“Something went wrong”), and drops spam with a hidden honeypot field.
Out of the box they run in demo mode: nothing is sent, and the fields are logged in the browser console. Pick a destination before you publish.
Connect a form service
Section titled “Connect a form service”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: your inbox, a CRM, a booking tool, Google Sheets, Slack | The webhook (“catch hook”) URL |
With a webhook you can route each form by its form field: free-trial requests to your sales team, bookings to the
club, messages to your inbox.
-
Create a form at the service and copy its endpoint.
-
Open
assets/js/config.jsand paste it:window.siteConfig = {formEndpoint: "https://formspree.io/f/abcdwxyz",formAccessKey: "", // Web3Forms only}; -
Serve the folder (
npx serve .), submit each form (a contact message, a free-trial request, a booking from a club page) and check that the submissions arrived. -
Upload
config.jswith the site.
Every page loads the same config.js, so one endpoint serves the three forms. The sample form in style-guide.html
stays in demo mode whatever you set there (it carries data-form-demo), so it never sends anything.
What the service receives
Section titled “What the service receives”Each field by its name, as multipart/form-data, plus form and subject, which tell the forms apart.
The contact form on Contact (form: contact, subject “Get in Touch”, button “Submit”):
| Field | Name | Required |
|---|---|---|
| Name | Name |
|
Email |
yes | |
| Phone | Phone |
|
| Contact Time Preferences (Morning, Afternoon, Evening, Night) | Contact Time |
yes |
| Message | Message |
The free-trial form on Free Trial (form: free-trial, subject “Claim Free Trial”, button “Submit”): the same
fields as the contact form, plus two choices:
| Field | Name | Values |
|---|---|---|
| Preferred Location | City |
One of the ten cities |
| Preferred Class | Class |
One of the first ten programs |
The booking form on every club page (form: booking, subject “Book Your Class Now”, button “Book Now”):
| Field | Name | Required |
|---|---|---|
| Name | Name |
|
| Phone | Phone |
|
Email |
yes | |
| Club Location (filled in with the club’s name) | Club |
|
| Preferred Date | Date (YYYY-MM-DD) |
|
| Preferred Time | Time (HH:MM) |
|
| Additional Notes | Message |
The e-mail and the contact time are required (the original design required only the contact time); an e-mail that doesn’t look like an address is refused without sending. If the service answers with an error, the form shows “Something went wrong” and keeps what was typed.
Changing the fields
Section titled “Changing the fields”The forms are plain HTML in the pages: a <form data-form> in contact.html, free-trial.html and every page in
club/. Their messages are attributes of the form (data-success="Thank you", data-error="Something went wrong",
data-submit-label="Submit"), and each field is a <label> holding its text and an <input>, <select> or
<textarea>.
- To make a field required, add
requiredto its<input>or<textarea>; to make the contact time optional, removerequiredfrom its<select>. The browser then asks for the field before sending. - To add a field, copy a
<label>…</label>block, and change its text, thename, theplaceholderand thetype(text,email,tel,date), or copy the message’s block for another text area. - To change the choices of the free-trial form, copy or delete a radio’s
<label>in its group and change itsvalueand its text; keep the group’sname(City,Class). The cities and classes are written out, so a new club city or program doesn’t appear there by itself. - To remove a field, delete its
<label>block. - Keep the hidden
formandsubjectinputs, and don’t give a real field the namefax: it is the honeypot’s (Spam and privacy).
The booking form is copied into all 30 club pages: change it with find and replace in files (Editing the site), and keep each club’s own name in its “Club Location” value.
Testing before launch
Section titled “Testing before launch”- Submit each form on your own site after uploading, with a real address, and check the destination.
- Reply to the test message.
- Try a failure on purpose: a wrong endpoint, submit, and confirm the visitor sees “Something went wrong” and their text is still there.
Spam and privacy
Section titled “Spam and privacy”The honeypot stops the usual bots: every 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. Form services filter spam on their side too; turn on their captcha if
spam still gets through.
Submissions go only to the endpoint you set; the site itself stores nothing. The forms collect names, e-mails and phones: make your Privacy Policy say how you handle them and which form service receives them. The legal pages in the download are samples written for the made-up Waras gym (Editing the site).