-
Notifications
You must be signed in to change notification settings - Fork 748
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 Form Detection #4529
Comments
How important is the server-routing.js script? Would it be bad to remove it from one page as a temporary work-around? |
Hey @shootyourbricks i started looking it today. Will share more details tomorrow 👍🏽 |
@shootyourbricks can you confirm if you are using the |
Here is a detailed analysis on why the netlify form detection is not working right now. It is because of The webhook-form that is available is not the best bet for the use-case. The other workaround is try using code-embed, but need some more testing on the solid use-case Here is a total analysis of the use-case, i opened an issue on netlify. Because even they need to find a solution or else their form detection won't work out of the box anymore. cc @kof |
@JayaKrishnaNamburu For static export I'm using the publish->export feature in the WebStudio dashboard. |
In other words netlify needs to fix their hack, otherwise user needs to use a regular Form component, not a Webhook Form, which uses Remix Form and Netlify breaks it. With a regular form user can't use webstudio form handling logic and need to integrate something external. |
Here's the thing though. I'm not using a webhook form. I even tried embedding a form via html component and that didn't work either |
@shootyourbricks in what sense it didn't work? regular form element doesn't have functionality beyond submitting regular html form... |
@kof Netlify didn't detect the form unless that js script was removed |
I'm trying to test netlify ssg, however I have not been successful as I am running into an unrelated error. Posted a help post on Discord. Will share my results as soon as I have it figured out. |
Currently, the Second, i created and tested a custom code |
Thanks for working on this.
I don't quite understand what you're saying about the webhook forms. Are you saying it's better to use the webhook form? Which did you use in the example? Netlify works with actionless forms in plain HTML files (not ws). I successfully got Netlify to detect a regular form with the SSG and two deploys as you explained but the form wouldn't submit. It would go to a 404 when submitting. |
If you are looking to deploy the app as a
Check if you are redirection to some page under the |
@JayaKrishnaNamburu There is no action for the form. In fact it looks like even though Netlify detected the form, it hasn't changed any of the actual attributes. "data-netlify" is still there and the hidden input is missing. Here's the link for the webstudio project: https://p-bc461e1d-1866-4bbc-b54f-dae4c136fd5b.apps.webstudio.is/?authToken=e5fd87ef-8ba2-4a56-93d3-2a5bdae6e1cf&mode=preview Here's the link to the deployed site on Netlify: https://ws-form-test.netlify.app/ EDIT: read below messages before debugging to save time :) |
@JayaKrishnaNamburu Are you able to take a look at my project? I have both the HTML form and a native WebStudio form which are both detected by Netlilfy, but still don't work. |
I got it working by adding a hidden input with the name value of "form-name" and the value as the actual form name (in this case "contact" and "WSNative") This is what Netlify was supposed to add during form detection. Did you have to add that manually? @JayaKrishnaNamburu |
It looks like if I remove the entry-server-routing.js script the deployment works as it should (I remove it after running the netlify build command but before running netlify deploy) Why is this script being created when using the ssg template? @JayaKrishnaNamburu |
NOTE: It seems that the entry-server-routing.js script that blocks form detection/processing (the form is detected but the HTML isn't changed even on static files) and the whole problem with Remix apps are separate. Looks like there's a workaround for the Remix app side of things, so I made a GH discussion for that as it is something that Webstudio would have to implement. So I'd like to focus on the js script here in this thread. |
Looks like, netlify don't work with auto detect when used along with any framework. Which they shared it in their GitHub issue here So, there is a workaround which is shared by their team Which is not possible to implement using the builder at And regarding to your question on
Currently when you select a I am not sure, if the workaround that netlify team is suggesting can be built right into the wwebstudio build system. More in this @kof can help if we ever decide to bring in support for that workaround. Because tomorrow the team might come up with new workaround and the builder can't implement and break existing ones. Bottom line, netlify form detection doesn't work with anything other than plain html files. |
Whether I use the netlify-ssg template or simply export and download static files for vanilla or netllify builds, I always get the js script Here's my project https://p-3e6aec26-235a-41d3-a79b-6dc9a6e8f287.apps.webstudio.is/?authToken=37314ef1-5936-406d-9d7a-729638817506&mode=preview Attached is the index.html file (renamed to .txt) and you can see the script at the bottom. /assets/entries/entry-server-routing.CcTuSK9F.js That's the one that keeps the form detection from fully working |
Ok, i took a little bit deeper look on the build setup for ssg builds. Looks like, when you webstudio/packages/cli/templates/ssg/vite.config.ts Lines 5 to 7 in 4f026a0
If you look around here const clientRoutingEntry = resolve(`dist/esm/client/client-routing-runtime/entry.js`)
const serverRoutingEntry = resolve(`dist/esm/client/server-routing-runtime/entry.js`)
if (hasClientRouting) {
entries['entries/entry-client-routing'] = clientRoutingEntry
}
if (hasServerRouting) {
entries['entries/entry-server-routing'] = serverRoutingEntry
} By default vike injects this |
Hey, i still haven't gotten any update from them. So, opened a discussion on the vike repo. To get some opinions on it But honestly, all these tools, |
Netlify automatically detects html forms during deployment. WebStudio forms (and html forms in an embed component) are not detected unless the entry-server-routing.js file is removed from the static build.
Steps to reproduce bug:
Steps to get the form detected (NOT an ideal workaround)
The text was updated successfully, but these errors were encountered: