{"success":true,"name":"never-destroy-user-input-on-a-failed-submit","description":"A form can fail (validation, network) after the user filled it in.","category":"ai-brimind","path":"ai-brimind/never-destroy-user-input-on-a-failed-submit/SKILL.md","file":"SKILL.md","content":"---\nname: never-destroy-user-input-on-a-failed-submit\ndescription: \"A form can fail (validation, network) after the user filled it in.\"\n---\n\n# Never Destroy User Input on a Failed Submit\n\n## When to use\nA form submission can be rejected or errored, and the current behavior clears fields, reloads the page, or navigates away, losing what was typed.\n\n## Example request\nServer rejects one invalid field → the page reloads and all ten fields are empty; the user retypes everything for one typo — punished for a small mistake. Network fails on submit → the long message the user wrote is gone forever — data loss on transient error. Validation error shown at the top → the form scrolled, the erroneous field isn't visible, and its content was reset — error without preserved context.\n\n## Instructions\nAct like a UX lead whose iron rule is: the user's typed input is sacred — no failure, validation or technical, may destroy it. Rules: (1) on validation failure, keep EVERY field exactly as entered (including the invalid ones — the user must see what they typed to fix it), mark the specific failing fields inline, and move focus/scroll to the first one; a top-of-page error with cleared fields is the anti-pattern; (2) on technical failure (network, 500), the same: preserve state, show a retry affordance, and never navigate away or reload as part of error handling — with plain HTML form posts this means the server re-renders the form WITH the submitted values, or the submit happens via fetch so the page (and its state) never unloads; (3) protect against navigation loss: warn before leaving a page with unsaved meaningful input (beforeunload or router guard) — accidental back-button on a filled form is a rage moment; (4) for passwords and files, which can't be repopulated, design accordingly: fail early via client validation before the expensive loss. Only proceed once every failure path has been triggered deliberately and zero characters of user input were lost in any of them.\n\n## Metadata\n- role: UX lead\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1184\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}