From f3e645a3ed8afd83098e3207cf5dd8ecc42cb199 Mon Sep 17 00:00:00 2001 From: Keith Date: Mon, 23 Nov 2026 17:50:01 +0100 Subject: [PATCH] Lead form: flat urlencoded payload for Zoho Flow (Zoho wraps parsed body in its own payload var; browsers can't send application/json - no CORS on webhook). Pricing rolled into message (founders: message IS the pricing answers). New founders webhook URL. --- src/components/LeadForm.astro | 72 +++++++++++++++++++---------------- src/data/site.json | 2 +- src/i18n/en.json | 3 +- src/i18n/it.json | 3 +- src/i18n/mt.json | 3 +- src/layouts/Site.astro | 4 +- 6 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/components/LeadForm.astro b/src/components/LeadForm.astro index a944fcb..bbc6094 100644 --- a/src/components/LeadForm.astro +++ b/src/components/LeadForm.astro @@ -2,12 +2,15 @@ // The lead form used by both audience pages. Labels come from the shared // per-locale strings; on submit a small fetch POSTs the payload to the // page's Zoho Flow webhook (token-in-URL authentication, no server code). -// Deliberately minimal — the CRM only needs a name and an email; country -// is deduced downstream from the submitted locale or the IP address. -// The hubs variant carries a hidden "capabilities" field (set by the -// capability checklist) and the founders variant a hidden "price_range" -// field (set by the pricing checklist) — leads arrive in the CRM already -// tagged with what interested them. +// Deliberately minimal — the Flow's trigger parses the body into its own +// "payload" variable, so the fields go FLAT: first_name, last_name, email, +// consent (the CRM requires last_name). Browsers cannot send application/ +// json cross-origin to Zoho (no CORS headers on the webhook), so the form +// posts application/x-www-form-urlencoded, which the trigger parses into +// the same fields. There are no separate pricing fields: on the founders +// page the pricing answers ARE the message; on the hubs page selections +// are appended to the visitor's message. Country is deduced downstream +// from the IP address. const { type: pageId, locale, strings, site } = Astro.props; // pageId arrives as the route id ("for-founders"/"for-support-organisations") // — normalise to the form kind: @@ -16,12 +19,14 @@ const type = pageId === "for-founders" ? "founders" : "hubs"; const fields = type === "founders" ? [ - { name: "name", label: strings.field_name, input: "text", required: true }, + { name: "first_name", label: strings.field_first_name, input: "text", required: true }, + { name: "last_name", label: strings.field_last_name, input: "text", required: true }, { name: "email", label: strings.field_email, input: "email", required: true }, ] : [ { name: "organisation", label: strings.field_organisation, input: "text", required: true }, - { name: "name", label: strings.field_name, input: "text", required: true }, + { name: "first_name", label: strings.field_first_name, input: "text", required: true }, + { name: "last_name", label: strings.field_last_name, input: "text", required: true }, { name: "email", label: strings.field_email, input: "email", required: true }, { name: "message", label: strings.field_message, input: "textarea" }, ]; @@ -71,11 +76,7 @@ const note = type === "founders" ? strings.form_founders_note : strings.form_hub autocomplete="off" aria-hidden="true" /> - - - -