Replies: 1 comment
-
The object returned is a If you really need deeper nesting, you could look for a library (there is e.g. In case your page requires JS to function properly, you could also send a nested object directly as JSON and parse that on the server. This is generally not recommended; forms should ideally still work in cases where the JS failed to load which can e.g. happen with unstable network conditions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Simple example: Post has many metadata. Create a form that takes post data, and under metadata section, you can add multiple metadata records.
In Rails, I would use the convention of square brackets. e.g. post[name], post[metadata][][name] (or post[metadata][0][name]). And the resulting params when submitted would be parsed as:
In SvelteKit however there appears to be no built in way to handle this? The request.formData() returns a simple JS map, with keys and values, nothing nested, which makes sense, because this isn't an HTTP standard.
I am wondering however, what is the best way to handle this? Are their popular libraries that handle this? Or is it just a case of rolling my own function?
Beta Was this translation helpful? Give feedback.
All reactions