From f0d90cccb492cbffec3d654ef81ac1a8d903bac9 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 13:44:30 +0000 Subject: [PATCH] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- src/components/PlansSection.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/PlansSection.tsx b/src/components/PlansSection.tsx index 5e10b94..b064022 100644 --- a/src/components/PlansSection.tsx +++ b/src/components/PlansSection.tsx @@ -143,10 +143,17 @@ const PlansSection = () => { e: React.ChangeEvent ) => { const { name, value } = e.target; - setForm((p) => ({ ...p, [name]: value })); + setForm((p) => { + const next = { ...p, [name]: value }; + if (name === "postnummer") { + const suggested = cityFromPostalCode(value); + if (suggested) next.stad = suggested; + } + return next; + }); if (errors[name]) setErrors((p) => ({ ...p, [name]: "" })); - if (name === "postnummer" && errors.postnummer) { - setErrors((p) => ({ ...p, postnummer: "" })); + if (name === "postnummer") { + setErrors((p) => ({ ...p, postnummer: "", stad: "" })); } };