Lead payload hardening: price_model mirrored into the form, selections concatenated into message
deploy / build-and-publish (push) Successful in 38s
deploy / build-and-publish (push) Successful in 38s
- the model picker lives outside <form>; a hidden price_model input now
mirrors the pick on change so FormData carries it natively (switching
model also clears price_range + its echo - programmatic unchecking
fires no change event)
- on submit, all tracked selections are concatenated into the message
field ('Selected features: ...', 'Pricing model: ...', 'Price answers:
q = €x; ...') so the Zoho Flow mapping cannot drop them even if it only
maps the standard fields; machine fields (capabilities, price_range,
price_model, locale, source, consent) still sent alongside
This commit is contained in:
@@ -73,6 +73,7 @@ const note = type === "founders" ? strings.form_founders_note : strings.form_hub
|
||||
/>
|
||||
<input type="hidden" name="capabilities" value="" />
|
||||
<input type="hidden" name="price_range" value="" />
|
||||
<input type="hidden" name="price_model" value="" />
|
||||
<input type="hidden" name="locale" value={locale} />
|
||||
<input type="hidden" name="source" value={type} />
|
||||
<label class="consent">
|
||||
@@ -131,9 +132,20 @@ const note = type === "founders" ? strings.form_founders_note : strings.form_hub
|
||||
// not the checkbox's literal "on"; an unchecked box never arrives)
|
||||
payload.consent = data.get("consent") === "on";
|
||||
if (payload.website) return; // honeypot: pretend success, send nothing
|
||||
// the pricing-model picker lives outside the <form> element
|
||||
const modelPick = document.querySelector('input[name="price_model"]:checked');
|
||||
if (modelPick) payload.price_model = modelPick.value;
|
||||
// The pricing-model picker sits outside the <form>; it is mirrored
|
||||
// into the hidden price_model input on change, so FormData carries it.
|
||||
// On top of the machine fields, concat every tracked selection into
|
||||
// the message: Zoho Flow reliably maps the standard fields only, and
|
||||
// this way nothing is lost in field mapping.
|
||||
const lines = [];
|
||||
const capLabels = [...document.querySelectorAll("[data-cap]:checked")]
|
||||
.map((c) => c.dataset.capLabel || c.dataset.cap);
|
||||
if (capLabels.length) lines.push("Selected features: " + capLabels.join(", "));
|
||||
if (payload.price_model) lines.push("Pricing model: " + payload.price_model);
|
||||
const pricePairs = [...document.querySelectorAll("[data-price]:checked")]
|
||||
.map((c) => c.dataset.priceGroup + " = " + c.dataset.priceLabel);
|
||||
if (pricePairs.length) lines.push("Price answers: " + pricePairs.join("; "));
|
||||
if (lines.length) payload.message = (payload.message ? payload.message + "\n\n" : "") + lines.join("\n");
|
||||
button.disabled = true;
|
||||
button.textContent = STRINGS.sending || "Sending…";
|
||||
try {
|
||||
|
||||
@@ -390,6 +390,16 @@ const hasForm = isAudiencePage;
|
||||
sets.forEach((s) => s.classList.toggle("active", s.dataset.modelSet === model));
|
||||
pricing.querySelectorAll("[data-price]").forEach((r) => { r.checked = false; });
|
||||
groups.forEach((g) => { g.hidden = true; });
|
||||
// mirror the pick into the form's hidden field so it rides
|
||||
// the FormData payload even though the picker is outside <form>
|
||||
const mirror = document.querySelector('form input[name="price_model"]');
|
||||
if (mirror) mirror.value = model;
|
||||
// programmatic unchecking fires no change event - clear the
|
||||
// hidden payload field and its echo by hand
|
||||
const pr = document.querySelector('form input[name="price_range"]');
|
||||
if (pr) pr.value = "";
|
||||
const echo = document.getElementById("price-selection");
|
||||
if (echo) { echo.textContent = ""; echo.hidden = true; }
|
||||
if (groups[0]) {
|
||||
groups[0].hidden = false;
|
||||
try { groups[0].scrollIntoView({ behavior: "smooth", block: "nearest" }); } catch {}
|
||||
|
||||
Reference in New Issue
Block a user