[Solved] Umbraco Forms Submit Always Refreshes Page
l
I'm hitting a wall on where to look and could use another brain to throw suggestions on where I've gone wrong or what sort of place I could look for a conflict. I've got forms [using Umbraco Forms package] that should be showing a message on submit but instead all forms are reloading the page when they're submitted. There is no go-to page set, I can't see any issues in the console, network tab, or in Logs. Am I missing some setup? I have the 'RenderUmbracoFormDependencies(Url)' at the bottom of the head and am using the 'umb-forms-render-scripts' tag at the bottom of the body. As far as I can tell that's all that's required for setup? There is no other validation stuff or jquery or anything setup. Literally just installed & put those two snippets into the layout. Using the supplied 'insert form' data type and copy-paste of the RenderForm snippet from documentation. @await Component.InvokeAsync("RenderForm", new { formId = content.DisplayForm, includeScripts = false }) *tested with & without includeScripts just in case and it changes nothing.
s
The form will indeed be submitted through a page load and uses temp data to show a message (if set). To customize the behaviour on submit you can setup the workflows attached to the form
l
Workflow is setup on the forms to show a thank you message. But users never see it because on submit the page refreshes and then resets the form. I'm trying to figure out why it's doing that, cause it shouldn't be. Expected behavior: form submits > thank you message shows > nothing else notable happens. Actually happening: form submits > page refreshes so thank you message never shows & form is reset. I've used forms before on older versions and haven't had this problem. I figure I've gotta just be missing some setup somewhere? There's no appsettings or anything done, just the two things I mentioned above and appear to be the only thing required for 'setup' from what I can find. But I can be pretty blind sometimes :3
Just bumping. Still looking for any brainstorm ideas on what could be missing or where I've gone wrong in setup^^;
d
Do you have caching enabled on that page? Pages with Umbraco Forms out of the box should not be cached
As pointed out by Sander, the page refresh is expected behaviour, but I noticed with CDN caching, Umbraco Forms indeed doesn't show the thank you message
l
Oooo, well we don't have anything special around caching setup. No CDNs or anything. Is there somewhere we can tell Umbraco to... not cache? Not sure this is the problem cause I experience this even with 'disable cache' on incognito/private browsers. But it gives me a new place to investigate! Ty
! Actually, maybe one of my earlier suspicions is the culprit... There's a Service Worker, which would be caching for offline use. But I tested previously with a sibling of the site that had no service worker at all and it was having the same problem. But I didn't clean out cookies :0 Testing now on the other site with a new computer it doesn't happen! 😭
Now how to make forms work with a service worker... Learnin' new things wooo!
Just quickly hopping back in here to add what the actual solution was in case anyone in the future comes looking. The problem: URL Rewriting from SEO Checker. It was set to 'force remove trailing slash', which was inserting a 301 redirect after the POST cause it uses trailing slash. Just so happened that the sister site had that difference in setting as well as no service worker :p
d
wow, good job figuring that out!
182 Views