---
name: html-form-debugger
description: "A targeted diagnosis of why an HTML form will not validate or submit: the exact markup or JavaScript flaw with its line, why it produces the symptom you see, and the minimal code change that fixes it. Use when a form does nothing on submit, shows a validation bubble it should not, reloads the page, or sends the wrong data and the user has the markup and script. Do not use for a general accessibility or structure audit of a working form, or server-side handler bugs. Related topics: coding, html."
---

# HTML Form Debugger

A targeted diagnosis of why an HTML form will not validate or submit: the exact markup or JavaScript flaw with its line, why it produces the symptom you see, and the minimal code change that fixes it.

## When to use

Use this skill when a form does nothing on submit, shows a validation bubble it should not, reloads the page, or sends the wrong data and the user has the markup and script. Do not use it for a general accessibility or structure audit of a working form, or server-side handler bugs.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Match the symptom to a failure class (no action, blocked by validation, unintended reload, wrong payload) so the search starts in the right layer.
3. Check the markup in order: submit control association, name attributes, required and pattern attributes, hidden required fields.
4. Check the script for preventDefault timing, listener attachment, stopped propagation, FormData source, and body versus content-type mismatch.
5. Consult browser-specific behaviour for the selected browser only after the generic causes are ruled out.
6. Name the root cause with its line, explain how it produces the observed symptom, and give the minimal corrected snippet.

## Inputs

- **HTML source** (longer free text)
- **JavaScript handling** (longer free text)
- **Observed error** (free text, e.g. "Error message or what happens instead")
- **Browser** (choose one: Chrome, Firefox, Safari, Edge, Other)
- **Form method** (choose one: GET, POST)
- **Expected behaviour** (free text, e.g. "What should happen on submit")
- **Server-side symptoms** (free text, e.g. "request never arrives or arrives with empty fields or 415 error")

## Output

A markdown report with sections Summary (one line), Identified issues (each with line reference and effect), and Suggested fixes (exact snippets), plus one line on how to confirm it works.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### HTML Form Debugger

Find out why my form does not submit or validate and give me the exact fix.

#### Details
- HTML source: {{HTML source}}
- JavaScript handling: {{JavaScript handling}}
- Observed error: {{Observed error}}
- Browser: {{Browser}}
- Form method: {{Form method}}
- Expected behaviour: {{Expected behaviour}}
- Server-side symptoms: {{Server-side symptoms}}

Reproduce the failure from the symptom: nothing happens on click, a validation bubble appears, the page reloads unexpectedly, or the request leaves with wrong data. Check the markup in this order: the submit control is inside the form or linked by the form attribute, every field has a name (fields without one are never submitted), required and pattern attributes are what the user thinks they are, and no hidden required field is blocking native validation silently. Then check the script: preventDefault called before or after validation, a submit listener attached before the form exists in the DOM, event bubbling stopped by a parent, FormData built from the wrong element, or a content type that does not match the body (JSON body with a form-encoded header). Consider browser-specific behaviour for the selected browser only once the generic causes are ruled out. Name the single root cause with the line it lives on, explain how it produces the exact symptom, and give the minimal corrected snippet. Mention a second candidate only when the evidence supports two.

## Pitfalls

- Overlooking a field without a name attribute, which is valid HTML and silently never reaches the server.
- Blaming the fetch code when a hidden required input is blocking native validation with no visible message.
- Rewriting the whole form instead of the one line at fault, which loses the user's styling and makes the fix hard to review.
