I have a very small Ajax form using MVC. The form fires the Controller as expected and when it hits Model.IsValid method, it returns false as expected and fires the Json Success = false line.
Problem is, the view does not handle the Json response it returns this with the Json response printed out as text "{"success":false}":
I am using the exact same code in a v6.1.6 instance of Umbraco and it works perfectly. So when I looked a the HTML code for the working page and the non working page, I noticed that the form was created differently for 6.1.6 vs 6.2.0
Form for v6.1.6
<form action=/umbraco/Surface/QuickContact/MESQuickContactPost data-ajax="true" data-ajax-failure="ShowErrorQuickMsg()" data-ajax-method="POST" data-ajax-mode="replace" data-ajax-success="ShowSuccessQuickMsg()" data-ajax-update="#submit-status-quick" id="frmQuickContact" method="post">
<div>Input Stuff Here</div>
<script>
function ShowErrorQuickMsg() {
$("#submit-status-quick").html("Oops, there was an Error")
}
function ShowSuccessQuickMsg() {
$("#submit-status-quick").html("Message sent successfully");
$("#Name").val("");
$("#Email").val("");
$("#Message").val("");
}
</script>
</form>
But this is what is generated from 6.2.0
<form action=/umbraco/Surface/DimeContactForm/SubmitContactFormAction id="frmContactForm" method="post" onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, httpMethod: 'POST', updateTargetId: 'submit-status', onFailure: Function.createDelegate(this, ShowErrorMsg()), onSuccess: Function.createDelegate(this, ShowSuccessMsg()) });">
<div>Input Stuff Here</div>
<script>
function ShowErrorMsg() {
$("#submit-status").html("Oops, there was an Error")
}
function ShowSuccessMsg() {
$("#submit-status").html("Message sent successfully");
$("#FirstName").val("");
$("#LastName").val("");
$("#EmailAddress").val("");
$("#Message").val("");
}
</script>
Ajax.BeginForm acting weird MVC v6.2.0
Hello Umbracians!
I have a very small Ajax form using MVC. The form fires the Controller as expected and when it hits Model.IsValid method, it returns false as expected and fires the Json Success = false line.
Problem is, the view does not handle the Json response it returns this with the Json response printed out as text "{"success":false}":
http://localhost:58523/umbraco/Surface/DimeContactForm/SubmitContactFormAction
I am using the exact same code in a v6.1.6 instance of Umbraco and it works perfectly. So when I looked a the HTML code for the working page and the non working page, I noticed that the form was created differently for 6.1.6 vs 6.2.0
Form for v6.1.6
But this is what is generated from 6.2.0
Did I do something wrong?
is working on a reply...