-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Netlify Adapter: Netlify Forms don't work #942
Comments
honestly, this would all go away if Netlify relied less on autodetection and made it easy to declare forms in the UI. perhaps feedback for @bencodezen |
To be honest I don't exactly know how to proceed here. Is maybe #1046 related? Any suggestions what the actual issue is and how to fix it? |
sorry i know it must be frustrating. bottomline is the html form must exist at render time for Netlify to detect it (aka not rendered later only in clientside, or in a serverless function). have you ensured that that happens? if we had a nice repro repo i could probably look into fixing for you |
I'm also having this issue with Netlify: previously working forms are no longer being detected during the build/deploy process. The forms are still listed in the "forms" section of my site control panel, yet do no work. |
hey @kvn-shn @rohiaudio i got it working, check this and see if it helps https://github.com/sw-yx/sveltekitnetlifyforms recorded 9 min video tutorial https://www.youtube.com/watch?v=cj3f2Xth5Mk blog version https://dev.to/swyx/how-to-use-sveltekit-with-netlify-forms-5gmj |
@sw-yx Thanks! I tried to set prerender to true and this led to the form at least being detected by Netlify. However, if I turn on Netlify's captcha integration, the captch box briefly appears on screen and then disappears upon hydration. If I turn hydration to false, the captcha box shows up and stays but then my custom handleSubmit function doesn't work anymore. |
repro repo would help |
@sw-yx, thanks for looking into it. So basically I added the prerender step to the Svelte config, added the But -- story is not over yet ;) -- then I also removed the form's Now I would just like to know why the |
the action attribute navigates to a page, but you probably dont have that page set up |
I have the page set up of course. Else I'd probably get a 404 from Svelte but simply nothing is happening. Could you try it out with your example repo if the action is working for you? I guess Svelte (or Netlify?) is messing something up with the "URL that processes the form submission" (according to MDN). |
realistically i probably wont get to it sorry. feel free to modify my code to do it |
So I played around with it a little more and can now definitely say that Netlify forms are not working out-of-the-box when using a custom success message. But I have good news as well: It's working fine when prerendering the "success" page too! TL;DR In the following a small conclusion... How to make Netlify forms work in SvelteKit
(This issue could even be closed now. Or should we add these steps to the readme?!) |
I created a PR basically adding the above comment #942 (comment) to the Netlify Adapter's readme as I think it makes sense to explain it more prominently: #1481 |
Thanks for merging, @benmccann. I'll close this issue then. |
Recent update has changed how you did the
|
@Blumed sorry i didnt see that - thank you, hope the readme was also updated, i havent been watching that closely |
I followed these instructions and cannot svelte to render form as prerendered page. I used static adapter and netlify adapters with same results. |
@ilkkanisula Are you able to post your repo or a replica? I can try and take a look at it. My update I was using these versions: |
Describe the bug
Netlify Forms don't work in a Svelte component if setup with this approach and using the Netlify adapter.
Edit: For a workaround/fix see the comment below #942 (comment)
To Reproduce
Expected behavior
A form submission should be shown in Netlify's form overview if submitted via my SvelteKit webapp.
Information about your SvelteKit Installation:
Severity
Blocker, as Netlify's simple form handling is one of the key benefits I'm using it for. However, right now I cannot use Netlify Forms with SvelteKit.
Additional context
The text was updated successfully, but these errors were encountered: