Copied to clipboard

Flag this post as spam?

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

  • lori ryan 239 posts 573 karma points
    May 06, 2021 @ 19:51
    lori ryan

    umbraco forms ajax submission

    Hi just wondering is there any more recent solutions of getting umbraco forms to post with ajax so the page doesnt refresh and maintain page position?

  • Nik 1600 posts 7180 karma points MVP 6x c-trib
    May 06, 2021 @ 22:10

    Hi Lori,

    There are 2 different ways, that I've seen, to achieve this.

    1. The full AJAX way -> If you are using JQuery (or a-n-other type of JS library with ajax/async posting abilities) you could hook into the press of the submit button, cancel the default behavour, manually serialise the form. and submit it via an AJAX call. However, there is quite alot of manual behaviours you need to consider when doing this, such as error handling, response types etc.

    2. The other approach, and one I've used on v7 and v8 sites, is to take advantages of Unobtrusive Ajax, stuff from MVC concepts. Paul Seal has a great video/blog about it here: One thing to note, in this blog, Paul uses the Ajax.BeginForm helper, but you can manually add the same data attributes to a Html.BeginUmbracoForm approach (which personally I think is better).



Please Sign in or register to post replies

Write your reply to: