我刚执行的演示jquery的UI对话框(模型对话框)样品 并试图把它列入我的asp.net mvc的项目,我已经观察到一些奇怪的。

如果你有一个jQuery UI的对话框div标签里面的内容,默认的模型绑定不发送到服务器,因为它在如果从形式去除这些元素把它捡起来

全视图的代码如下。如果在底部看到,有部分,其中的对话框的含量:

<div id="dialog"

的问题是,在我的“分区对话”内表,还存在的一定数量的映射到我的结合数据对象字段的输入。当我在调试期间看我的控制器动作,这些都是空发布后。

什么可以在jQuery UI的对话框js代码做将从默认的模型粘合剂“范围”发布时,作为代码的形式元素中删除吗?


JavaScript代码:

<script type="text/javascript">
    $(function() {

        $("#dialog").dialog({
            bgiframe: true,
            autoOpen: false,
            height: 500,
            width: 500,
            modal: true,

            buttons: {
                'Create an account': function() {

HTML代码

    <% using (Html.BeginForm("UpdateTester", "Applications", FormMethod.Post))
       {%>

        <table id="users" class="ui-widget ui-widget-content">
            <thead>
                <tr class="ui-widget-header ">
                    <th>Name</th>
                    <th>Email </th>
                    <th>Details</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <input type='hidden' name='peopleUpdater.person[0].c' value="1" />
                        <input type='hidden' name='peopleUpdater.person[0].b.Id' value="1" />
                        <input type='hidden' name='peopleUpdater.person[0].a[0].Id' value="1" />                            John Doe
                        <input type='hidden' name='peopleUpdater.person[0].name' value="joe" />
                    </td>
                    <td>
                        john.doe@example.com
                        <input name='peopleUpdater.person[0].email' type='hidden' value="email" />
                    </td>
                    <td>
                        Locations:
                        <%=Model.BusinessLocations.Length %><input type="button" value="Details" id="showDetails" />
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <input type="submit" id="Button1" class="ui-button ui-state-default ui-corner-all" />Submit

    <div id="dialog" title="Create new user">
        <%=ApplicationHTMLHelper.BuildTableLocations("aa", Model.Application.BusinessLocations, true, "peopleUpdater.person[0]")%>
     </div>

<% } %>
有帮助吗?

解决方案

我发现与类似问题这个其他问题#1和它的工作原理部分

jQuery的模式窗口从我的形式移除元件

它猛推的对话框元素放回形式之前提交和修复该问题

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top