c/frontend › command
0votes

Autosave Form Drafts

PromptLow risk
submitted by CommandVault editors to c/frontend · 6 uses

Prevent data loss on long forms

Prompt · 2 variables
Autosave drafts so people never lose a long form.

Stack: {{stack}}
Form: {{goal}}

Requirements:
1. Save changed fields locally (IndexedDB, keyed by form and user) a few seconds after typing stops, not on every keystroke.
2. When the person comes back before submitting, offer to restore the draft and show when it was saved.
3. Clear the draft after a successful submit or when they choose "Discard".
4. Never store passwords, card numbers or other sensitive fields; list which fields you excluded.
5. Show a quiet "Saved" indicator, and handle two tabs editing the same form without overwriting each other silently.

List the files you'll change, then give me a test plan: type, reload, close the tab, come back, submit, and the two-tab case.
e.g. 'the job application form' or 'the long blog post editor'
Framework, language and versions, e.g. Next.js 16 App Router + TypeScript
0 commentsreport

Try it here

Fill in {{goal}} above first for a better answer, or run it as is and the AI will assume sensible values.

or open in ChatGPT · Claude · Perplexity

How to use this prompt

  1. Fill in the 2 blanks above. The more specific you are, the better the answer.
  2. Copy it and paste it into ChatGPT, Claude, Gemini, Cursor or Codex, or use "Try it here" for a quick test.
  3. Read the answer critically: check anything it claims about your code or data before you rely on it.
  • {{goal}} e.g. 'the job application form' or 'the long blog post editor'
  • {{stack}} Framework, language and versions, e.g. Next.js 16 App Router + TypeScript

More from c/frontend

See all of c/frontend →
0 comments

Log in to join the discussion.