Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormData does not include submit button value and name #351

Closed
peerreynders opened this issue Jan 8, 2024 · 1 comment
Closed

FormData does not include submit button value and name #351

peerreynders opened this issue Jan 8, 2024 · 1 comment

Comments

@peerreynders
Copy link

Describe the bug

FormData is captured without including name/value of the submit button:

Defect location: In the vicinity of

const data = new FormData(evt.target as HTMLFormElement);

Compare to previous implementation: https://github.com/solidjs/solid-start/blob/443955f7fe677f558f613d80bafd78b570c136f6/packages/start/data/Form.tsx#L283-L287

Supporting background: FormData doesn't include value of buttons

Clicking on the Log In button when client side JS is enabled produces on the server side:

(email, kody@example.com)
(password, twixrox)

Clicking on the Log In button when client side JS is disabled produces on the server side:

(email, kody@example.com)
(password, twixrox)
(kind, login)

i.e. the JS enabled version is lacking the "kind", "login" name/value pair from the (clicked) button element inside the <form>.

Your Example Website or App

https://github.com/peerreynders/solid-router-formdata

Steps to Reproduce the Bug or Issue

See https://github.com/peerreynders/solid-router-formdata/blob/main/README.md

Expected behavior

The FormData to be identical regardless whether client JS is enabled or disabled.

Screenshots or Videos

No response

Platform

  • OS: Ubuntu 22.04.3 LTS
  • Browser: Chromium
  • Version: 120.0.6099.199 (Official Build) snap (64-bit)

Additional context

No response

@ryansolid
Copy link
Member

Thanks never noticed that previously but then again we have to thank Remix for a lot of the research there.

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

No branches or pull requests

2 participants