Depending on what type of form you are submitting, this will be much nicer to use than using the standard BeginForm.
As for the Ajax.BeginForm, I can confirm this behavior and it occurs because the Ajax.BeginForm overload you are using is incorrect. I'm assuming you'd like to make the <form id = "FrmTopLogin" ? The overload you are using is this one: http://msdn.microsoft.com/en-us/library/dd504974(v=vs.108).aspx
@using (Ajax.BeginForm("Login", "OnmLogin", null, new AjaxOptions
{
UpdateTargetId = "loading",
HttpMethod = "post",
OnBegin = "OnLoginBegin",
OnComplete = "OnLoginComplete",
}, new { id = "FrmTopLogin" }))
Or this:
@using (Ajax.BeginForm("Login", new { controller = "OnmLogin" }, new AjaxOptions
{
UpdateTargetId = "loading",
HttpMethod = "post",
OnBegin = "OnLoginBegin",
OnComplete = "OnLoginComplete",
}, new { id = "FrmTopLogin" }))
Or the other ones that use the IDictionary<string, object> instead of anonymous objects.
The reason it is showing you the RenderMvc route is because it thinks you are passing in a string object to the object RouteValues parameter which is invalid so it thinks its null so its displaying the default MVC route which currently in this case is the RenderMvc route.
U4.10 BeginForm Issue
Hi all,
When I use Html.BeginForm then the form action looks fine but when I use Ajax.BeginForm then form action is not what is required.
Above code parse form action as below:
<form action="/umbraco/Surface/AppLogin/Login" id="form" method="post" id="form">
Above form action is fine.
but when I use
The form action is parse as
<form action="/Umbraco/RenderMvc/Login?Length=8" data-ajax="true" data-ajax-begin="OnLoginBegin" data-ajax-complete="OnLoginComplete" data-ajax-method="post" data-ajax-mode="replace" data-ajax-update="#loading" id="FrmTopLogin" method="post">
In this second parse form action is not as per my controller.
Any suggestions please?
Kind Regards
PTamang
Any help please?
I have sent it to Shannon (who did the MVC part) so he can have a look. Stay tuned.
Thanks Stephen :)
Hi, ensure you read the documentation here regarding 'BeginUmbracoForm':
https://github.com/umbraco/Umbraco4Docs/blob/4.8.0/Documentation/Reference/Mvc/forms.md
Depending on what type of form you are submitting, this will be much nicer to use than using the standard BeginForm.
As for the Ajax.BeginForm, I can confirm this behavior and it occurs because the Ajax.BeginForm overload you are using is incorrect. I'm assuming you'd like to make the <form id = "FrmTopLogin" ? The overload you are using is this one: http://msdn.microsoft.com/en-us/library/dd504974(v=vs.108).aspx
You need to use a different overload to acheive this, you can see this list here:
http://msdn.microsoft.com/en-us/library/system.web.mvc.ajax.ajaxextensions.beginform(v=vs.108).aspx
You can either do this:
Or this:
Or the other ones that use the IDictionary<string, object> instead of anonymous objects.
The reason it is showing you the RenderMvc route is because it thinks you are passing in a string object to the object RouteValues parameter which is invalid so it thinks its null so its displaying the default MVC route which currently in this case is the RenderMvc route.
is working on a reply...