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" /> - - - -