Hello,
I just started experimenting with jqModal and am having a strange issue.
The modal window is displayed correctly however I get a javascript error when I click anywhere inside it. When I look at the offending line of code, it turns out that jqModal is trying to run my entire page as if it were one big piece of javascript.
Since I wrote this post, I discovered that the code works fine in FireFox. The issue is IE of course.
My markup:
<script type="text/javascript">
$(document).ready(function () {
$('#jqmWindowContainer').jqm({
modal: true,
ajax: '<%: Url.Action("Save", "AssetSearch") %>',
onHide: myAddClose
});
function myAddClose(hash) {
hash.w.fadeOut('300', function () { hash.o.remove(); });
}
});
</script>
<a href="#" class="jqModal display-field-right">Save this search</a>
<span id="jqmWindowContainer" class="jqmWindow">
</span>
Modal window markup:
<div id="modalWindow" class="jqmWindow">
<% using (Ajax.BeginForm("Save", "AssetSearch", new AjaxOptions() { HttpMethod = "Post", InsertionMode = InsertionMode.Replace, UpdateTargetId = "modalWindow" }))
{%>
<!-- Validation summary -->
<div class="validation-summary">
<%=ViewData["Message"]%>
</div>
<%=Html.LabelFor(x => x.Name)%>
<%=Html.TextBoxFor(x => x.Name)%>
<!-- Submit button -->
<div class="submit-form">
<input type="submit" value="Save" />
</div>
<%
}%>
</div>
<a class="jqmClose" href="#">Close</a>
Clicking on the “Save this search” link correctly displays the modal window. Clicking anywhere in the modal, causes this error:
Line: 5 Error: Object doesn't support this property or method
When I look at the code it’s trying to execute, it turns out to be my whole page which of course triggers an error:
I have no clue what would cause this behavior. If I continue past the error, the window works correctly and my action method gets called when I click Save. Help!
Thanks!
Rick