Skip to content
Sign inJoin waitlist

Forms — KorDent Next.js

The four forms of this Next.js template work as soon as you run it: 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, submissions are written to the server log (FORM_PROVIDER=console). That’s fine while you build, but useless once you publish, so pick a destination before launch. One provider serves all four forms; every submission carries the title of its form, so you can tell them apart in your inbox or tool.

  1. Copy the example settings:

    Terminal window
    cp .env.example .env.local
  2. Choose one:

    You want Set
    An email for every submission FORM_PROVIDER=resend + RESEND_API_KEY, FORM_EMAIL_TO, FORM_EMAIL_FROM
    It in your practice software, CRM, Slack, a spreadsheet… FORM_PROVIDER=webhook + FORM_WEBHOOK_URL (Zapier, Make, n8n, Formspree, your own API); optional FORM_WEBHOOK_SECRET
    The sender in a Mailchimp audience FORM_PROVIDER=mailchimp + MAILCHIMP_API_KEY, MAILCHIMP_AUDIENCE_ID; optional MAILCHIMP_STATUS

    Several at once work: FORM_PROVIDER=resend,mailchimp.

  3. Restart npm run dev and send a test from each form.

  4. Put the same variables in your host’s dashboard before deploying. .env.local is not uploaded.

Details for each provider, what it receives, the webhook payload, Mailchimp consent settings and how to write your own provider are in Forms reference.

The booking form (title “New appointment request”, button “Confirm Booking”), in three steps:

Field Name it arrives under Required
Select Dental Treatment (cards of every 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 email yes
Confirmation Contact Preference (Call, Whatsapp, 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 on Contact (“Send a Direct Message”, title “New contact message”, button “Send Message”): name (Full Name), phone (Phone Number), email (Email, required) and message (Message / Inquiry, required).

The review form on Home and Services (“Share Your Experience”, title “New patient review”, button “Submit Review”): name (Full Name), email (Email), treatment (Treatment Type: the title of 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. To publish one, add it to src/content/collections/testimonials.ts (Editing the content).

The newsletter in the footer (title “New newsletter subscriber”, button “Subscribe Now”): email (required).

Resend puts the sender’s name after the title in the email’s subject (the title alone when there is no name) and sets the reply address to the sender’s e-mail. Mailchimp stores the name as FNAME, tags the contact with the title and keeps the rest as a note. A webhook receives every field of the form, as "" when left empty, with its label.

The labels, placeholders, choices, the button’s three texts and the title of each submission are content:

Form Copy Server action
Booking booking in src/content/site.ts submitBooking in src/lib/actions-booking.ts
Contact form in src/content/pages/contact.ts submitContact in src/lib/actions-contact.ts
Review testimonials.form in src/content/pages/home.ts (and the same in services.ts, which the Services page shows) submitReview in src/lib/actions-review.ts
Newsletter footer.newsletter in src/content/site.ts subscribeNewsletter in src/lib/actions-newsletter.ts

A field arrives at your provider under its name, so keep the names you already map somewhere. The review form sends the labels and the title of home.ts, also from the Services page.

Each server action sends every field listed in its copy and checks the required ones again on the server, so the list in the copy is the place to edit:

  • To make a field required, set required: true on it. The browser checks it before sending and the server checks it again (the label shows no mark, as in the original design: write “(Optional)” on the others if you like, as the booking form’s notes do). A required field must be on the page: if it is only in the list, every submission fails.

  • To add a field, add an entry, for example an insurance provider on the contact form:

    insurance: { name: "insurance", label: "Insurance Provider", placeholder: "e.g. Delta Dental", autoComplete: "off" },

    The types are text (the default), email, tel, url, date, time, select (with options) and textarea. The fields are laid out by hand, so also place it in the form: <FormField {...fields.insurance} /> in src/components/sections/contact/ContactSection.tsx (the booking form: src/components/sections/booking/BookingForm.tsx; the review form: src/components/sections/home/TestimonialsSection.tsx).

  • To remove a field, delete its entry and its <FormField … /> line.

  • The treatments and dentists of the booking form and the review form’s treatments come from the collections (services.ts, doctors.ts): a new service or dentist appears in them by itself. Which dentists a treatment offers is the service’s doctors list.

  • Don’t give a real field the name fax: it is the honeypot’s (Spam).

  • Submit each of the four forms on your own site after deploying, with a real address: a booking from Book and one from a service page, a contact message, a review and a newsletter sign-up.
  • Check the destination (inbox, spreadsheet, audience) and reply to the test.
  • Try a failure on purpose: set a wrong API key, submit, and confirm the visitor sees “Something went wrong” and their text is still there.

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. If you start getting spam anyway, put a service in front through the webhook provider (Formspree, Web3Forms and Basin all include spam filtering), or add a captcha to the form component.

Submissions go only where you point them; nothing is sent anywhere else. 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 provider that meets it. The site itself stores nothing. KorDent has no consent checkbox; the footer links a Privacy Policy, Terms of Use and an Accessibility Statement whose text (src/content/collections/legal.ts) is a demo to replace with your own, and the demo’s promises (“100% HIPAA compliant data care” in the call to action) are yours to keep only if they are true.

Only the newsletter asks for marketing consent by its nature. If you send every form to Mailchimp, keep MAILCHIMP_STATUS at transactional (the default): those contacts can get your replies, not your campaigns. The provider applies to all four forms, so patients who book or write also land in the audience, tagged with the form’s title; if you don’t want that, use another provider.