Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Danine Noble 82 posts 368 karma points
    Mar 08, 2024 @ 20:48
    Danine Noble
    0

    Umbraco Forms: Submit reloads page so message never shows

    Heyo ^^

    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 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?


    Have tried:

    • removing the PWA service worker (in case it was that caching that was causing problems?) -- no change
    • removing the CSP rules in case there was a conflict. Don't know how to get page to not refresh after submit for debugging so couldn't tell if there was a conflict. T.T -- no change though so prolly not.
    • Cleared all storage/cookies and caches -- no change
  • Danine Noble 82 posts 368 karma points
    Apr 01, 2024 @ 14:24
    Danine Noble
    0

    Still interested in any ideas on what I'm missing about setup to have forms stop reloading the page on submit when it should just be showing a thank you message. <3

    There is no other validation stuff or jquery or anything setup. Literally just installed & put those two snippets I mentioned 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 })
    

    *adding note, have tested with & without includeScripts and it changes nothing.

  • Danine Noble 82 posts 368 karma points
    Jun 19, 2024 @ 17:20
    Danine Noble
    100

    Just updating this ^^

    The issue is the Service Worker caching. Not sure how I failed that test early on, but testing again on a completely new computer with no service worker ever registered and the forms work.

    Problem though... how to go about making forms work with a Service Worker then..? xD Initially setting this up I was following this guide for doing it specifically with Umbraco so dang!

    Currently investigating how to do 'Network First' instead of this Cache First* approach. I think that'll solve it? Though I thought it was already doing that for non-Get requests soooo, we'll see!

    (adding that the linked guide is actually a Network First' approach, it's version name is just misleading :3 A wonderful guide for anyone looking for Service Worker example!)


    Update - Found the culprit: SEO Checker

    With it enabled, Forms does the POST, then redirects with 302 -> 301 -> GET request for the page. So while, yes, can't do a cachefirst with Service Worker there were 2 layers of issues! T.T

    The final bit that solved this was either: 1) Disable url rewriting in SEO Checker, or 2) Make sure the option about trailing slashes is NOT set to force remove. Either other option is fine.

Please Sign in or register to post replies

Write your reply to:

Draft