Skip to content

Include form-associated custom elements in form submissions - #807

Open
kmmbvnr wants to merge 2 commits into
unpoly:masterfrom
kmmbvnr:fix/web-component-formdata
Open

Include form-associated custom elements in form submissions#807
kmmbvnr wants to merge 2 commits into
unpoly:masterfrom
kmmbvnr:fix/web-component-formdata

Conversation

@kmmbvnr

@kmmbvnr kmmbvnr commented Aug 17, 2026

Copy link
Copy Markdown

This pull request fixes the original issue #593.

I develop Viewflow.io and am evaluating alternatives to Turbolinks, Hotwire/Turbo, and htmx. During that work, I found a discrepancy in Unpoly. An [up-submit] form dropped values from form-associated custom elements. A normal browser submission included them.

What changes

up.Params.fromForm() now begins with native FormData(form). It uses the browser's form-data construction algorithm. This includes form-associated custom elements and values appended by formdata listeners.

The method then adds configured Unpoly fields that are absent from form.elements. This keeps up.form.config.fieldSelectors working for non-native controls. It does not duplicate native or form-associated controls.

This is a small submission-only change. It does not change up.Params.fromContainer() or Unpoly's watcher behavior.

Compatibility

Existing native controls keep browser submission semantics. Configured custom controls still submit when they expose name, value, and disabled properties.

Verification

  • I added specs for formdata listeners, form-associated custom elements, and configured non-native controls.
  • I ran npm run lint, npm run build-ci, and the focused Chrome up.Params suite.

Authorship

This PR was AI-assisted and made with Codex Terra. I reviewed every line and take responsibility for the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web Component form field dropped by up-submit

1 participant