Files
AndreaSlopFotografie/aidlc-docs/features/homepage-sections/construction/contact/functional-design/business-rules.md
T
SluijsensandClaude Opus 5.5 0fce403ebc Adds the Contact section to the homepage
Adds the contact form with the live fields, validation and browser-side
anti-spam, behind a coming-soon notice with a mail button until the API
exists. A "Boek" link on a price card selects its package, tidies the
URL and moves focus to the form. The form loads only when it comes near
the screen, so the hero does not wait for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 00:36:43 +02:00

7.1 KiB

Business Rules — Unit 5: Contact

Sources: FR-HP-06…09, unit 3's BR-PARAM-02…04, contact-fd-questions.md and contact-fd-clarification-questions.md.

Validation

ID Rule Message
BR-FORM-01 naam is required (after trimming) "Vul je naam in."
BR-FORM-02 email is required "Vul je e-mailadres in."
BR-FORM-03 email must look like an address: ^[^\s@]+@[^\s@]+\.[^\s@]{2,}$ after trimming "Dit e-mailadres is ongeldig."
BR-FORM-04 shoot must be one of the shoot options "Kies een soort shoot."
BR-FORM-05 bericht is required "Schrijf hier je vraag."
BR-FORM-06 Maximum lengths: naam 100, email 254, bericht 2000 (also maxLength on the fields) "De naam is te lang." / "Het e-mailadres is te lang." / "Het bericht is te lang."
BR-FORM-07 Per field the first failing rule wins, in the order required → length → format —

When errors show (Q1 = B)

ID Rule
BR-FORM-10 A field is checked when the visitor leaves it, but only once they have typed in it; tabbing through an untouched empty field shows nothing.
BR-FORM-11 On submit every field is checked; if any is invalid, nothing is sent and focus moves to the first invalid field.
BR-FORM-12 A shown error is re-checked while typing and disappears as soon as the field is valid (it is not re-shown while typing; a new error only appears on leaving or submitting).
BR-FORM-13 Errors are linked to their field (aria-describedby, aria-invalid) and announced.

Sending

ID Rule
BR-SEND-01 Valid and not spam → state sending: button disabled, label "Versturen…"; the payload (trimmed values) goes to submitContactForm.
BR-SEND-02 Success → state sent: the form is replaced by "Bedankt voor je bericht! Ik reageer binnen 1-2 werkdagen." and focus moves to that message (Q3 = A).
BR-SEND-03 Failure → state failed: above the button "Versturen lukte niet. Probeer het later nog eens of mail naar info@andreaslop.nl" with the address as a mail link (BR-MAIL-01); what the visitor typed stays; the next submit tries again (Q6 = A).
BR-SEND-04 A second submit while sending is ignored.

Anti-spam (FR-HP-08)

ID Rule
BR-SPAM-01 Spam when the honeypot website is not empty, or less than 3000 ms passed since the form became usable.
BR-SPAM-02 Spam gets the normal success (state sent), but nothing is sent. Validation still runs first, like for a person.
BR-SPAM-03 No robot-check script is loaded in this feature; the form keeps a slot for Friendly Captcha (FR-HP-09).

Gate (FR-HP-07)

ID Rule
BR-GATE-01 contactForm.enabled = false → the form is visible but dimmed and inert; over it the notice "Binnenkort", "Het contactformulier komt binnenkort. Mail me voor nu op info@andreaslop.nl" and the button "Stuur een e-mail".
BR-GATE-02 The address is assembled from siteContent.email in the browser (existing emailAddress); if it is invalid the notice shows only "Het contactformulier komt binnenkort." without address or button.
BR-GATE-03 enabled = true → the form works normally and the notice is not rendered.
ID Rule
BR-MAIL-01 Every mail link (notice button, address in the notice, address in the failure message) opens a mail with a subject: "Aanvraag fotoshoot: " when the visitor arrived via a "Boek …" link (a package is selected from ?pakket=), otherwise "Vraag via andreaslop.nl". Subject is URL-encoded.

Preselection from "Boek …" (unit 3, BR-PARAM-02…04)

ID Rule
BR-PARAM-02 When the page has a pakket value: if it names a shown package (packageFromSearch), the shoot field takes that package — replacing an earlier choice (last click wins, BR-PARAM-03). Then pakket is removed from the URL with a history replace, keeping #contact, without scrolling. Unknown values are removed the same way and change nothing.
BR-PARAM-04 This happens the same way with the gate on or off (with the gate on, the package still feeds the mail subject).
BR-FOCUS-01 After arriving via a "Boek …" link (any pakket value present), focus moves to the "Contact" heading (programmatic focus, no visible ring), so keyboard and screen reader users continue in the right place (Q5 = A). A normal page load does not move focus.

Decision flow: submit

graph TD
    Submit["Visitor submits"] --> Busy{"Already sending?"}
    Busy -->|"yes"| Ignore["Ignore"]
    Busy -->|"no"| Valid{"All fields valid?"}
    Valid -->|"no"| ShowErrors["Show errors, focus first invalid field"]
    Valid -->|"yes"| Spam{"Honeypot filled or under 3 s?"}
    Spam -->|"yes"| FakeSent["Show thank-you, send nothing"]
    Spam -->|"no"| Sending["Sending: button disabled"]
    Sending --> Result{"Adapter result"}
    Result -->|"ok"| Sent["Replace form by thank-you, focus it"]
    Result -->|"error"| Failed["Failure message with mail link, keep input"]

    classDef input fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
    classDef decision fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
    classDef outcome fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
    class Submit input;
    class Busy,Valid,Spam,Result decision;
    class Ignore,ShowErrors,FakeSent,Sending,Sent,Failed outcome;

Text alternative: a submit is ignored while sending; otherwise invalid input shows errors and focuses the first invalid field; valid spam gets the thank-you without sending; valid input is sent, and the result either replaces the form by the thank-you or shows the failure message with a mail link while keeping the input.

Decision flow: arriving with ?pakket=

graph TD
    Arrive["Homepage with pakket in the URL"] --> Known{"Names a shown package?"}
    Known -->|"yes"| Select["Shoot field takes the package, replacing an earlier choice"]
    Known -->|"no"| Keep["Shoot field unchanged"]
    Select --> Clean["Remove pakket with history replace, keep hash contact"]
    Keep --> Clean
    Clean --> Focus["Focus the Contact heading"]

    classDef input fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
    classDef decision fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
    classDef outcome fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
    class Arrive input;
    class Known decision;
    class Select,Keep,Clean,Focus outcome;

Text alternative: a known package is selected (replacing an earlier choice), an unknown one changes nothing; either way the parameter is removed from the URL with a history replace and focus moves to the Contact heading.

Misuse considerations (SECURITY-11)

  • Form spam: gate today; honeypot and time check in the browser; Friendly Captcha, server-side validation and rate limiting in the API feature (the browser checks are never the only defence).
  • Input is only ever rendered as text by React and sent as JSON later; pakket is never reflected.
  • Failure messages are generic (no technical details, SECURITY-15).