Briefly summarise the issues you have been experiencing.
So I’m trying to use the forms feature on my page, I’m using Vue.js + Nuxt, which allows me to prerender using static page generator following the steps described here How to Integrate Netlify Forms in a Vue App
but I cannot see the form neither the submissions on my admin dashboard. Also when I submit it trought axios http call, I get a 404 directly.
I’m not sure if it needs to be on production directly and it will not work on a Branch Deploy like staging. Also, it’s any way to test if a page is pre- rendered ?
I used curl -A twitterbot https://staging.alvarosaburido.com/en/contact/ and I get all the page with the forms.
But if I use curl -A twitterbot https://staging.alvarosaburido.com/en/contact without the / at the end it shows <html><head></head><body></body></html> .
@themicrogirl, welcome to our online community and thank you for letting us know that Divya’s solution works perfectly for you as well.
Feedback about both what works and what does not helps us to keep our community topics, documentation, and example git repos up to date. We appreciate you taking the time to share your experience as this is a key part of keeping our recommendations and solutions up to date. Thanks again for letting us know!
The bit that tells Netlify that there’s a form on the page is the data-netlify: true attribute in the form markup. From the post your linked, I mentioned the need to prerender. This is so that the Netlify bots can see your form on the page. In the case of a non prerendered SPA, Netlify can’t see the form since the markup is being generated by the JS dynamically. In the case of the Nuxt project, I’m generating to static pages, as a result, the form is easily visible to Netlify and it registers it appropriately. With this setup, there’s no need to add the form in the app.html.
Thanks for the longer explanation.
I use nuxt generate in order to deploy my application so I expected that the bots would be able to find my forms.
Here’s part of my code :
is the configuration in nuxt.config.js. She used mode: universal which is for Isomorphic application (server-side rendering + client-side navigation). Please note that as of today (Feb 2, 2022), the mode option has been deprecated, so you might (as I did) used ssr:false which correspond to option mode:spa. In my mind, Netflify does not run a node server in the back-end, only static sites, therefore I opted for ssr:false, and apparently my thought was wrong.
I don’t know if anyone could comment on the most up-to-date set up in nuxt.config.js.
Thanks
Roberto
Is it the use of Netlify Forms you are having issues with (as the OP was)? Reading your post it seems nothing to do with forms, rather specifically about SSR.
If you are disabling SSR then pre-rendering isn’t an issue as everything it built static/client-side rendered.
Hi, yes I came from an issue in Netlify forms. I was struggling to make it work and after some investigation, I had noticed that my nuxt config were: "ssr:false; target:“static”, as compared to Divya’s code, in which the config was: “mode:universal”.
However, as of today, mode universal is deprecated, so I had to remove ssr:false, in order to make netlify forms to work.