Skip to content

Appointment request form in WordPress

A short form for independent businesses: name, phone, reason, preferred date and a morning or afternoon slot, with validation and a confirmation summary.

Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in WordPress

formulaire-prise-rendez-vous.php
<?php
/**
 * Plugin Name: Forge, Formulaire de prise de rendez-vous
 * Description: Un formulaire court pour indépendant : nom, téléphone, motif, date souhaitée et créneau matin ou après-midi, avec validation et récapitulatif de confirmation. Ajoute la composition « Formulaire de prise de rendez-vous » à l'éditeur de blocs.
 * Version: 1.0.0
 * Requires at least: 6.6
 * Requires PHP: 8.1
 * Author: Forge
 * License: GPL-2.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: forge-formulaire-prise-rendez-vous
 *
pattern.html
<!-- wp:html -->
<div class="prdv" data-prdv>
        <div class="prdv__head">
          <p class="prdv__eyebrow">Salon Ambre · Coiffure mixte</p>
          <h2 class="prdv__title" id="prdv-titre">Prendre rendez-vous</h2>
          <p class="prdv__intro">Laissez votre numéro et vos disponibilités : nous vous rappelons dans la journée pour fixer l'heure exacte.</p>
        </div>
        <form class="prdv__form" novalidate action="#prdv-envoi" aria-labelledby="prdv-titre">
          <p class="prdv__note">Tous les champs sont obligatoires.</p>
          <div class="prdv__summary" tabindex="-1" role="group" aria-labelledby="prdv-summary-title" data-prdv-summary hidden>
            <h3 class="prdv__summary-title" id="prdv-summary-title" data-prdv-summary-title></h3>
            <ul class="prdv__summary-list"></ul>
script.js
(() => {
  if (!document.querySelector(".prdv")) return;
  const PRDV_HORIZON = 60;

  function prdvDay(offset) {
    const day = new Date();
    day.setHours(0, 0, 0, 0);
    day.setDate(day.getDate() + offset);
    return day;
  }

  function prdvIso(day) {
style.css
:root {
  --prdv-card: #ffffff;
  --prdv-text: #132a28;
  --prdv-muted: #4f625f;
  --prdv-line: #d5e5e1;
  --prdv-line-strong: #7a8f8b;
  --prdv-field: #ffffff;
  --prdv-accent: #0f766e;
  --prdv-accent-hover: #115e59;
  --prdv-accent-soft: #ecfdf9;
  --prdv-on-accent: #ffffff;
  --prdv-error: #b91c1c;

Free component: copy it freely, including for commercial projects.

Forms and inputs components in WordPress
  • A quote request form for tradespeople: the customer describes the work, picks a start date range and attaches up to six site photos, each with a preview, its size and a button to remove it.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A quote request form whose labels, hints and error messages are full French sentences, still readable at 320 px: nothing overflows, nothing is cut off, and each error is tied to its field.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Visitors pick a package and tick options: the pre-tax total, VAT and total including tax update live, and the summary is sent with the contact form.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A short NPS survey: a 0 to 10 score as radio buttons, then a follow-up question adapted to whether the customer is a detractor, passive or promoter.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An honest unsubscribe page: address prefilled from the link, choice between stopping everything or receiving less, optional reason and an undo.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A callback request form: French phone number checked and formatted, topic, working day and time slot, with explicit consent to the call.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component