I am using a Telerik Window to display a custom Edit Form for a Telerik Grid. The Telerik Window is in a form tag:
@using (Html.BeginForm("TestingAccommodationsEditPost", "TestingAccommodations", FormMethod.Post, new { id = "TestingAccommodationsEditForm" }))and I have a submit button:
<button type="submit" class="t-button t-grid-insert">Save</button>The submit JS is:
<script type="text/javascript"> $('#TestingAccommodationsEditForm').submit(function (e) { if (!window._504.AccommodationPlan.TestingAccommodations.IsFormValid()) { return false; } else { var data = $(this).serialize(); $.post(this.action, data, function () { $('#TestingAccommodationsEditForm').closest('.t-window').data('tWindow').close(); $("#TestingAccommodations").data("tGrid").ajaxRequest(); }); e.preventDefault(); return true; } });</script>The controller action is an EmptyResult with the following signature:
[HttpPost] public EmptyResult TestingAccommodationsEditPost(TestingAccommodationsEditModel model)The issue is that when I'm in IE8, submitting the Telerik Window results in the data being saved and a redirect to: http://localhost:19623/_504/TestingAccommodations/TestingAccommodationsEditPost. It shouldn't do anything but save the data and close the Window. Also if I watch IE Developer Tools, submitting the Telerik Window changes the Document Mode to 'Quirks'.
In IE9 it works correctly, on submit the Telerik Window closes so i can continue to interact with the page I was on. Attached is the complete code related to this issue. Can anyone advise on how to resolve this issue so that it works on IE8 just as well as it works in IE9? We are using version 2011.2.712 of the Telerik MVC tools with MVC4. Thank you.