Forms — KorDent HTML
The KorDent HTML template has four forms, and they send to the form service or webhook of your choice: the booking form, the contact form, the review form and the newsletter.
The booking form is on Book, on the Services page and on every service page; the contact form on Contact; the review form (“Share Your Experience”) on Home and on the Services page; the newsletter (“Smile Bulletin”) in the footer of every page. Each form checks the required fields, shows a spinner while sending, says “Thank you” 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: Google Sheets, Slack, your practice software, a CRM | The webhook (“catch hook”) URL |
-
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 booking, a contact message, a review, a newsletter sign-up) and check that the submissions arrived. -
Upload
config.jswith the site.
Every page loads the same config.js, so one endpoint serves all four 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.
The booking form (button “Confirm Booking”), in three steps:
| Field | Name | Required |
|---|---|---|
| Select Dental Treatment (a card per service; on a service page only that service, already chosen) | service (the service’s title) |
yes |
| Select Preferred Expert Dentist (the dentists of the chosen treatment; every dentist until one is chosen) | dentist (the dentist’s name) |
|
| Select Date | date |
yes |
| Select Preferred Time Slot | time |
yes |
| Full Name | name |
yes |
| Phone Number | phone |
yes |
email |
yes | |
| Confirmation Contact Preference: Call, Whatsapp or Email (Call to start with) | preference |
|
| Special Notes or Dental Symptoms (Optional) | notes |
The booking form is a request, not a calendar: the date and time are what the patient asks for, and your team confirms the visit. Nothing checks your opening hours or other bookings.
The contact form (“Send a Direct Message”, button “Send Message”): name (Full Name), phone (Phone Number),
email (Email, required) and message (Message / Inquiry, required).
The review form (“Share Your Experience”, button “Submit Review”): name (Full Name), email (Email), treatment
(Treatment Type: every service, required), rating (Satisfaction Rating, 1 to 5 stars) and review (Your Review). A
review is sent to you; it doesn’t appear on the site by itself (Editing the site).
The newsletter (“Subscribe Now”): email (required).
Each form also sends form and subject, so you can tell them apart in your inbox or tool:
| Form | form |
subject |
|---|---|---|
| Booking | booking |
New appointment request |
| Contact | contact |
New contact message |
| Review | review |
New patient review |
| Newsletter | newsletter |
New newsletter subscriber |
With formAccessKey set, the forms also send 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.
Changing the fields
Section titled “Changing the fields”The fields are ordinary <input>, <select> and <textarea> elements inside the <form data-form> of each page, each
in a <label> with its text. Change a label or a placeholder in place; the choices of a select are its <option>
elements (the first, empty one is the placeholder).
- To make a field required, add
requiredto it, and the asterisk after its label’s text (copy one from a required field). The browser checks it before sending. - To add a field, copy a
<label>…</label>and give its input a newname. The service receives whatever the form contains, so there are no settings to update. Don’t name a fieldfax: it is the honeypot’s. - To remove a field, delete its
<label>…</label>. - A treatment in the booking form is a
<label data-booking-service="…">holding its title, its summary and a radioname="service"whosevalueis what you receive.data-booking-servicelists the slugs of the dentists who give it, separated by commas; each dentist is a<label data-booking-doctor="<slug>">with a radioname="dentist". Once a treatment is chosen, the form shows only its dentists. - The review form’s treatments are the
<option>elements of itstreatmentselect.
The forms are copied into several pages: the booking form into book.html, service.html and every page in
service/, the review form into index.html and service.html, the newsletter into every page. Change each copy (find
and replace in files helps).
A field arrives under its name, so keep the names you already map somewhere. The button’s texts are written in the
button: the label (in the copies that flip on hover too), “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.
To send visitors to a page of your own after a successful send, add data-redirect="thank-you.html" to the <form>
(../thank-you.html in the pages of service/ and blog/).
Testing before launch
Section titled “Testing before launch”- Submit each of the four forms on the live site with a real address, 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.json 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 submissionswith the fields; after a failure,[forms] could not send the formwith the reason.
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. 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. A dental clinic’s forms collect health-related details (the booking form’s
symptoms, the contact form’s message), so check what the law where you practise asks of you — in the United States, for
example, HIPAA can apply to how you receive and store them — and choose a form service that meets it. KorDent has no
consent checkbox. The footer links a Privacy Policy, Terms of Use and an Accessibility Statement (legal/) whose text is
a sample to replace with your own (Editing the site), and the demo’s promises (“100% HIPAA compliant
data care” in the call to action) are yours to keep only if they are true.