solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.11k stars 138 forks source link

FormData does not include submit button value and name #351

Closed peerreynders closed 6 months ago

peerreynders commented 6 months ago

Describe the bug

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

Defect location: In the vicinity of https://github.com/solidjs/solid-router/blob/9755b8d478c3c7270885da12528818ef43c52485/src/data/events.ts#L114

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

Additional context

No response

ryansolid commented 6 months ago

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