Forms — Goeboek HTML
Goeboek’s HTML edition has three forms, the contact form, “Schedule tour” on every property page and the Add property form, and all three post to any form service or webhook you choose.
Each checks its fields in the browser (the first empty or wrong one gets the focus, and every wrong one is outlined in
Accent until it is changed), shows a spinner on the button while sending, and drops spam with a hidden honeypot field.
Once sent, the contact form shows “Thank you” on its button and clears its fields; “Schedule tour” opens
success-scheduled.html and Add property opens success-add-property.html. On an error the button says “Something went
wrong” and the form keeps what the visitor typed.
Out of the box they run in demo mode: nothing is sent, the fields are logged in the browser console, and the forms behave as if the submission had worked. 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, Google Sheets, Slack, a CRM. |
Every page loads config.js, so one setting covers the three 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,
and the thank-you pages are addressed from the site’s root.
What the forms send
Section titled “What the forms send”Every form adds two hidden fields: form (which form it is) and subject (the e-mail subject at the services that
email you). All three post to the same endpoint; form tells them apart. To send them to different places, use a
webhook (Zapier, Make, n8n) that routes on form.
The contact form on contact.html (form: contact, subject: “New contact enquiry”):
| Field | Name it arrives under | Required |
|---|---|---|
| Name | name |
yes |
email |
yes, and it must look like an e-mail address | |
| Message | message |
no |
“Schedule tour” on every property page (form: tour, subject: “New tour request”):
| Field | Name it arrives under | Required |
|---|---|---|
Property ID (filled in, e.g. 55W886) |
propertyId |
yes |
Property Name (filled in, e.g. South Sunlight Apartment) |
propertyName |
yes |
| Name | name |
yes |
email |
yes, and it must look like an e-mail address | |
| Phone | phone |
yes |
| Message | message |
no |
Add property on add-property.html (form: property, subject: “New property submission”), in the order of the
page:
| Group | Fields (name it arrives under) | Required |
|---|---|---|
| Personal Information | name, email, phone |
all |
| Property Description | propertyName; location (Brooklyn, Manhattan, Queens, Staten Island, The Bronx) and category (Apartments, Condos, Houses, Villas), radio buttons; for (Sell, Rent); price; duration (/Days, /Months, /Years) |
all but location and category |
| Property Details | size (m2), bedrooms, bathrooms, floor, additionalSpace, furnishing, ceilingHeight (m), constructionYear and renovation (dates, YYYY-MM-DD) |
all but renovation |
| Property Utility | heating, windowType (text); airCondition, fireplace, elevator, ventilation, intercom, cableTv, wifi (Yes, No) |
none |
| Message | message |
no |
A field left empty arrives empty; a radio group nobody picked does not arrive.
Changing the forms
Section titled “Changing the forms”Each form is a <form data-form …>. Each field is a <label data-field="…"> holding its text and an <input> (a
<textarea> for the message, a <select> with its <option>s for a choice); the control’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 texts: “Submit” is written twice in the button (once for screen readers while sending), and “Thank
you” and “Something went wrong” in the button’s spans and in
data-success/data-erroron the<form>: change both. - The thank-you page:
data-redirecton the<form>of “Schedule tour” and Add property names the page it opens once sent. Remove it to keep the visitor on the page with “Thank you” on the button, as the contact form does. - “Schedule tour” is copied into every property page: change it with find and replace in files. Its Property ID and
Property Name fields carry the property’s own values (
valueandplaceholder); set them on a new property’s page. - Add property’s Location and Category are written in the form, not read from the listings: add your locations and categories as radio buttons there too.
Keep the hidden fields (form, subject, and fax, the honeypot).
Testing before launch
Section titled “Testing before launch”- Send each form from your own site after uploading, with a real address: the contact form, “Schedule tour” on one property and Add property.
- Check the destination (inbox, spreadsheet, CRM), and that the two forms opened their thank-you pages.
- Try a failure on purpose: set a wrong
formEndpoint, submit, and confirm the button says “Something went wrong” and the 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”Submissions go only to the service you set; nothing is sent anywhere else. The forms collect names, e-mail addresses, phone numbers and details of people’s properties: 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).