Copied to clipboard

Flag this post as spam?

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

  • Matt Taylor 859 posts 2052 karma points
    Nov 11, 2020 @ 15:45
    Matt Taylor

    Ajax BeginForm problem with action not getting set correctly

    I've created a contact page in my Umbraco 8 project.

    It's got a form on it that I have created usingAjax.BeginForm

    @using (Ajax.BeginForm("SubmitForm", "Contact", new AjaxOptions()...

    It works fine, posting the form to the SubmitForm method of the Contact controller.

    I decided to duplicate the form some other pages, it's exactly the same form but it does not work.

    When I look at the html that has been generated on the other pages I can see that the action has not been populated.

    On the contact page we have

    <form action="/umbraco/Surface/Contact/SubmitForm?Length=7" data-ajax="true"...

    but on the other page we have

    <form action="" id="contact-form" method="post" onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));"...

    Why is it not creating the correct Ajax form on all other pages?



  • Matt Taylor 859 posts 2052 karma points
    Nov 11, 2020 @ 16:33
    Matt Taylor

    Fixed it.

    One thing I forgot was to include this on my other pages.


    The other thing I needed to do was use Html.RenderAction.

Please Sign in or register to post replies

Write your reply to: