sveltekit-superforms icon indicating copy to clipboard operation
sveltekit-superforms copied to clipboard

Form with method="GET"

Open LBF38 opened this issue 3 months ago • 2 comments

I'm building a simple search form and it uses the method="GET" on the form to have automatic search queries update on the url and everything is properly handled by Sveltekit (thanks to https://svelte.dev/docs/kit/form-actions#GET-vs-POST).

Thus, is this lib useful when building such forms ? I imagine that it can still help validate the form inputs and have better search params handling inside the page's load function.

What do you think ? Please feel free to share any thoughts about this topic.

LBF38 avatar Aug 19 '25 09:08 LBF38

Hi, yes it works very well for GET requests. I made post on X about it a while ago and haven't had time to update the documentation yet: https://x.com/encodeart/status/1787219133660065937

ciscoheat avatar Aug 20 '25 06:08 ciscoheat

Thanks for your response and the reference ! That's great !

In your example, you handle the search params using a custom func. Is it possible to have the minimal defined search params ?

I mean, in my tests, I've seen that, with method GET, all form inputs are automatically added to the page url even though some are undefined. Thus, my question, can we only have the inputs entered by the user and nothing else ? (+ schema validation obviously)

With this new info, I'll make my tests, thanks a lot ! 🙏

LBF38 avatar Aug 20 '25 15:08 LBF38