A detected form widget native browser autofill overwriting values bug is rarely what it looks like. The widget connects your existing HTML form, the browser offers to fill it, and a field ends up with the wrong string, a doubled value, or a blank where text was a second earlier. It feels like the widget is corrupting data. Almost always it is not. Autofill writes into fields according to what the browser can infer from name, type, autocomplete and label text. The Detected Form widget does not touch that inference. What it changes is when the form is live and how submissions are wired — which is exactly when pre-existing autofill mis-mappings become visible.
This guide is for static-site owners and developers who want the mechanism explained, the fix applied once with proper autocomplete tokens, and the result proven with a repeatable test script instead of a shrug and a reload.
What the Detected Form widget changes, and what the browser still owns
The Detected Form widget connects an existing HTML form to WidgetJar so submissions can be captured. It does not replace the browser's form engine. Field values are still assembled from each control's name and value when the form is submitted — MDN's guide to sending and retrieving form data describes how the names and values of the non-file controls are sent to the server as name=value pairs. If autofill puts the right string in the input, the right string is sent. If it puts the wrong string there, that is what gets sent.
So the division of responsibility is:
- Your markup: make each field's purpose unambiguous with a stable
name, a correcttype, a real<label>, and an explicitautocompletetoken. - The browser: decide whether to offer a saved profile or credential, and when.
- The widget: connect the form you already run. It is not a booking engine, an ROI calculator, or a custom validation layer.
The worst outcome is assuming the widget broke something and "fixing" it by stripping attributes. That removes the very signals autofill needs and makes the browser guess harder.
Why autofill appears to overwrite values
Three causes cover most reports.
Names that promise one thing and hold another. A field named name in a contact form usually means a person's full name, but next to an email field a browser or password manager may read it as a username. Give the field a descriptive name that matches its real content.
Missing or contradictory tokens. Without autocomplete, the browser pattern-matches on type, name, id, placeholder and label. When those disagree — type="text" on an email field, name="phone" on a field that wants a street address — the heuristic can pick the wrong saved value. Explicit tokens remove the guesswork.
Fill timing versus validation. Autofill can run after the page has already evaluated :invalid styles or written a custom error message. A field then holds a valid email with a stale error beside it, which reads to visitors as "the form overwrote what I typed." Treat autofilled values as user input and re-run your validation display whenever a value changes.
Useful mental model: autofill is an inference, not a random process. Every attribute you supply is a hint.
Map every lead-form field to the right autocomplete token
This table is the minimum mapping for a standard lead form. Keep name attributes stable once live; changing them mid-campaign creates its own confusion.
| Field purpose | type |
Suggested name |
autocomplete |
|---|---|---|---|
| Full name | text |
full-name |
name |
| Given / family name (if split) | text |
first-name, last-name |
given-name, family-name |
| Email address | email |
email |
email |
| Phone | tel |
phone |
tel |
| Company | text |
organization |
organization |
| Street address | text |
street-address |
street-address (or address-line1) |
| Message | <textarea> |
message |
leave unset |
| Consent checkbox | checkbox |
consent |
leave unset |
A deliberately boring example:
<form action="/thank-you" method="post">
<label for="full-name">Full name</label>
<input id="full-name" name="full-name" type="text" autocomplete="name">
<label for="email">Email address</label>
<input id="email" name="email" type="email" autocomplete="email" required>
<label for="phone">Phone (optional)</label>
<input id="phone" name="phone" type="tel" autocomplete="tel">
<button type="submit">Send request</button>
</form>
type="email" does double duty: it seeds the autofill heuristic and gives you built-in validation. MDN's article on client-side form validation explains that attributes like required, type and pattern let the browser check format before submission and block the form with an error message — while warning that client-side validation is only an initial check, never a substitute for server-side checks. For the wider token inventory, see form autocomplete attribute best practices for lead forms.
The email field deserves its own pass
Email is the field most often mis-filled, because browsers and password managers both treat it as a possible username. If it still misbehaves after adding autocomplete="email" and type="email", work through email autocomplete attribute HTML form: fixing email autofill before changing anything else.
Where disabling autofill backfires
Setting autocomplete="off" on every input feels decisive. It usually is not.
- Password managers may ignore it. Browsers and common extensions often override
autocomplete="off"on fields they recognise as identity fields, because their purpose is user convenience. - Mobile keyboards get worse. Without tokens, iOS and Android lose hints about which keyset to show. Typing a phone number without a numeric layout is a real friction cost.
- Keyboard and assistive-technology users lose speed. People using switch access, voice input or keyboard-only navigation benefit most from autofill. Blocking it is an accessibility regression. For the narrow case where suppression genuinely helps, read autocomplete off contact form fields: when it helps or hurts.
Suppress narrowly — a confirmation field or an internal reference number — and retest everything afterwards.
Labels, hints and validation ties that keep autofilled values correctable
Autofilled text is often right but unverified. The visitor did not type it, so the page must make it easy to read and fix.
- One visible
<label>per field, tied withfor/id. Placeholders are not labels. HTML form labels for clear lead forms covers wording and pairing. - Hints that persist after filling. A hint below the input stays useful once the field has content; a placeholder vanishes at the first character.
- Validation messages attached, not floated. Link the message with
aria-describedby, and re-check it oninputandchangeso a stale error never contradicts an autofilled value. - Focus behaviour when the form sits inside a popup. The W3C modal dialog pattern sets out the expected Tab, Shift+Tab and Escape behaviour; if focus escapes the dialog mid-fill, autofill can land in a field the user can no longer see.
A pre-launch test script: fill, tab, submit, verify
Run this once per browser family you care about — at minimum Chrome desktop, Safari on macOS, Safari on iOS and Chrome on Android — after the widget is connected.
Setup
- Save a complete autofill profile (name, email, phone, organisation, address) so the browser has something real to offer.
- Load the page in a private window with the profile available, so the form starts empty but autofill is armed.
- Open DevTools → Network and enable "Preserve log" so the submission payload survives any redirect.
Fill
- Focus the first field and trigger autofill the way a visitor would — tap the suggestion strip or use the fill shortcut. Pasting by hand proves nothing.
- Confirm each field received the expected value. Watch for a name in the email field, an email in the phone field, or a value appearing twice.
Navigate
- Tab from the first input to the submit button. Every field must be reachable, visibly focused, and show its label plus any hint or error text.
- Shift+Tab back and confirm the order reverses without trapping.
- Clear one autofilled field and blur it. Validation state must update — no stale error, no stale success styling.
Submit
- Submit with autofilled values untouched and note the outcome: inline confirmation or a redirect.
- In the Network panel, read the actual payload. The
name=valuepairs must match what you saw on screen. When a form sits inside a modal widget, remember that containment and focus return are part of the same pass — our modal dialog accessibility test script covers that side. - Repeat with one field edited by hand after autofill, then with a deliberately invalid value, to confirm both your messages and the endpoint's own checks behave.
- On a real phone, repeat fill and submit. Confirm the correct keyboard appears and the submit button is not hidden behind it.
What to check after converting a form, and how to log the result
Work through this list once, write the result down, and keep it with the page:
- Every visible
<label>is tied to its input withfor/id. - Each field has the correct
typeand a token from the mapping table. -
nameattributes are descriptive and stable. -
autocomplete="off"appears only where you can justify it in one sentence. - Validation display updates on
inputandchange, not only on submit. - Error and hint text is linked with
aria-describedby. - Tab order reaches every control, including consent and submit, in a sensible sequence.
- The endpoint received exactly the values shown on screen, verified in the Network panel.
- One row per browser/device tested, with date and result.
If a field still fills incorrectly, isolate it: swap in a bare <input type="text"> and retest. If the bare input is also mis-filled, the cause is the browser heuristic — return to the token and name mapping. If the bare input behaves and the styled one does not, the culprit is in your markup, usually a duplicate id, a wrapping <label> without for, or conflicting attributes.
Connect the form and keep the record
The point of the script is not to prove the form works once. It is to produce a record you can compare against after the next change — a new field, a reworded label, a theme update, a changed endpoint. Autofill bugs return quietly whenever markup drifts.
Once your mapping is in place and the payload matches the screen, connect the form to WidgetJar from the panel and confirm submissions arrive. Start with the Detected Form widget to connect the HTML form you already run, then review the available plans and the features overview to compare the wider platform before you commit.