Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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?
Thanks,
Matt
Fixed it.
One thing I forgot was to include this on my other pages.
Html.EnableClientValidation(); Html.EnableUnobtrusiveJavaScript();
The other thing I needed to do was use Html.RenderAction.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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
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
but on the other page we have
Why is it not creating the correct Ajax form on all other pages?
Thanks,
Matt
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.
is working on a reply...