Skip to content

fix: append array items individually to FormData for custom elements outside forms - #3963

Open
AndrewGit25 wants to merge 2 commits into
bigskysoftware:devfrom
AndrewGit25:fix/array-value-custom-elements
Open

fix: append array items individually to FormData for custom elements outside forms#3963
AndrewGit25 wants to merge 2 commits into
bigskysoftware:devfrom
AndrewGit25:fix/array-value-custom-elements

Conversation

@AndrewGit25

@AndrewGit25 AndrewGit25 commented Aug 18, 2026

Copy link
Copy Markdown

Description

Resolves an issue where elements outside <form> elements with .value returning an array (e.g., custom elements / web components) were joined as comma-separated string values (fruit=banana,apple) instead of appended as distinct entries (fruit=banana&fruit=apple).

  • Updates shouldInclude to check getRawAttribute(elt, 'name') for elements without a DOM .name property.

  • Converts array values in getValueFromInput so addValueToFormData appends array elements individually.

  • Includes unit tests in test/core/parameters.js.

Corresponding issue: N/A

Testing

Added unit test in test/core/parameters.js to verify that custom elements returning an array for .value append each item individually to FormData. Verified locally by running npm test, which runs linting (eslint), TypeScript type checks (tsc), and browser suite (web-test-runner on Chromium). All 848 tests passed.

Ran a test in scratchpad with a <custom-select> and successfully submitted formdata of name and value for each item in array. And no formdata was submitted without a name attribute. This is mirroring native <select multiple> behavior.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

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.

1 participant