1

我的视图中有一些提交按钮,并注意到在添加另一个提交按钮后,多个提交按钮已停止发布到控制器。我找不到可以为我指明正确方向的错误消息。

值为 create 的提交按钮工作正常,其值为“Upload”和“Upload Buffer”的提交按钮已停止工作。他们似乎根本没有击中控制器动作。在 Firefox 甚至 Safari 中一切正常。我记得添加的唯一新东西是带有滑块访问的日期时间选择器控制器。这可能会影响提交按钮吗?

看法

@model RunLog.Domain.Entities.RunLogEntry
@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/runLogEntry.js")" type="text/javascript"></script>

<fieldset>
    <legend>Enter a new Run Log Entry</legend>
    @using (Html.BeginForm("Create", "RunLogEntry", FormMethod.Post, new { id = "form", enctype = "multipart/form-data" }))
    {
        <div id="main">
            @Html.Partial("_RunLogEntryPartialView", Model)
        </div>
    }
</fieldset>
<script src="@Url.Content("~/Scripts/exitCode.js")" type="text/javascript"></script>

局部视图

@model RunLog.Domain.Entities.RunLogEntry
<script src="@Url.Content("~/Scripts/runDates.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/errorCode.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/testexception.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/datetime.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-timepicker-addon.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/css/Site.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript">

    var runDatesUrl = '@Url.Action("LogFileConfirmation", "RunLogEntry")';
    var runlogListErrorsUrl = '@Url.Action("ListErrorCodes", "RunLogEntry")';

    function displayDate(e) {
        $('#runDatestreeview :checked').removeAttr('checked');
    }

</script>
@Html.ValidationSummary(true)
<div class="exception">@(ViewBag.ErrorMessage)</div>
<div class="bodyContent">
    <span class="leftContent">Load List File (Select): </span><span class="rightContent">
        <input type="file" name="file" id="file1" style="width: 500px" />
    </span>
</div>
@if (Model.LoadListStoredFileName != null)
{
    <div class="bodyContent">
        <span class="leftContent">Attached Load List: </span><span class="rightContent">
            @Html.ActionLink(Model.LoadListFileName, "Download", new { @file = Model.LoadListStoredFileName })
        </span>
    </div>
}
<div class="bodyContent">
    <span class="leftContent">Output File (Select): </span><span class="rightContent">
        <input type="file" name="file" id="file2" style="width: 500px" />
    </span>
</div>
@if (Model.OutputStoredFileName != null)
{
    <div class="bodyContent">
        <span class="leftContent">Attached Output: </span><span class="rightContent">
            @Html.ActionLink(Model.OutputFileName, "Download", new { @file = Model.OutputStoredFileName })
        </span>
    </div>
}
<div class="bodyContent">
    <span class="leftContent">Log/Zip File: </span><span class="rightContent">
        <input type="file" name="file" id="file3" style="width: 500px" />
    </span>
</div>
@if (Model.AttachedLogFileName != null)
{
    <div class="bodyContent">
        <span class="leftContent">Attached Log File(s): </span><span class="rightContent">
            @Html.ActionLink(Model.LogFileName, "Download", new { @file = Model.LogFileStoredName })
        </span>
    </div>
}
<div class="bodyContent">
    <span class="leftContent">Import Files: </span>
    <button type="submit" id="btn_uploadbuffer" name="submit" value="UploadBuffer" class="art-button"
        style="width: 100px">
        Upload Buffer</button>
    <button type="submit" id="btn_upload" name="submit" value="Upload" class="art-button"
        style="width: 100px">
        Upload Normal</button>
    <button type="submit" id="btn_remove" name="submit" value="Remove" class="art-button"
        style="width: 100px">
        Remove Files</button>
</div>
@*<input name="inputName" type="hidden" id="hiddenInput" value="x" />*@
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Operator")
    </span><span class="rightContent">
        @Html.DropDownList("OperatorID", String.Empty)
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Run ID")
    </span><span class="rightContent">[Generated] </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Run Start Date / Time")
    </span><span class="rightContent">
        @Html.EditorFor(model => model.RunDate)
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("System")
    </span><span class="rightContent">
        @Html.DropDownList("SystemID", String.Empty)
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Run Type")
    </span><span class="rightContent">
        @Html.DropDownList("RunTypeID", String.Empty)
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Run Description")
    </span><span class="rightContent">
        @Html.TextAreaFor(model => model.RunDescription, new { style = "width: 600px; height=30px" })
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Assay Performance Issues")
    </span><span class="rightContent">
        @Html.DropDownList("AssayPerformanceIssues1", ListHelpers.YesNoList())
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Tests/Cycles Requested")
    </span><span class="rightContent">
        @Html.EditorFor(model => model.SPTestsRequested)
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Tests/Cycles Completed")
    </span><span class="rightContent">
        @Html.EditorFor(model => model.SPTestsCompleted)
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Run Status")
    </span><span class="rightContent">
        @Html.DropDownList("RunStatusID", String.Empty)
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Assay")
    </span><span class="rightContent">
        @Html.ListBoxFor(model => model.SelectedAssayIDs, new MultiSelectList(RunLog.Domain.Lists.GlobalList.AssayListItems(), "ID", "Name", Model.SelectedAssayIDs))
    </span>
</div>
<div class="bodyContent">
    @if (Model.RunDatesDisplay != null && Model.RunDatesDisplay.Count() > 0)
    {
        <span class="leftContent">
            @Html.Label("Run Dates")
        </span><span class="rightContent"><span id="RunDatesChildDialogLink" class="treeViewLink">
            Click here to Select/View Run Dates</span>
            <br />
            <span id="RunDatesDisplayy" style="cursor: pointer; text-decoration: underline;">
            </span></span>
    }
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Error Code")
    </span><span class="rightContent"><span id="ChildDialogLink" class="treeViewLink">Click
        here to Select Error Codes</span>
        <br />
        <span id="ErrorCodeDisplay" style="cursor: pointer; text-decoration: underline;">@(Model.ErrorDescription)</span>
        @Html.HiddenFor(model => model.ErrorDescription)
    </span>
</div>
<div id="treeview" title="Dialog Title" style="font-size: 10px; font-weight: normal;
    overflow: scroll; width: 800px; height: 450px; display: none;">
    <div id="errorCodes">
        @*  @Html.RenderTree(CacheHelper.ErrorCodes(), ec => ec.Name, ec => ec.Children.ToList(), ec => (ec.ID).ToString(), null, "e")*@
        @Html.RenderTree(CacheHelper.ErrorCodes(), ec => ec.Name, ec => ec.Children.ToList(), ec => (ec.ID).ToString(), Model.ErrorCodes, "error")
    </div>
    <div id="inputReps" style="display: none;">
    </div>
</div>
<div class="bodyContent">
    @if (Model.TestExceptionDisplay != null && Model.TestExceptionDisplay.Count() > 0)
    {
        <span class="leftContent">
            @Html.Label("Test Exceptions")
        </span><span class="rightContent"><span id="TestExceptionChildDialogLink" class="treeViewLink">
            Click here to View Test Exceptions</span>
            <br />
            <span id="TestExceptionDisplayy"></span></span>
    }
</div>
<div id="testExceptiontreeview" title="Dialog Title" style="font-size: 10px; font-weight: normal;
    overflow: scroll; width: 800px; height: 450px; display: none;">
    <table class="grid" style="width: 600px; margin: 3px 3px 3px 3px;">
        <thead>
            <tr>
                <th>
                    Exception
                </th>
                <th>
                    Frequency
                </th>
                <th>
                    Comment
                </th>
                <th>
                    Replicate Range
                </th>
            </tr>
        </thead>
        <tbody>
            @if (Model.TestExceptionDisplay != null)
            {
                @Html.EditorFor(x => x.TestExceptionDisplay)
            }
        </tbody>
    </table>
</div>
<div id="runDatestreeview" title="Dialog Title" style="font-size: 10px; font-weight: normal;
    overflow: scroll; width: 400px; height: 450px; display: none;">
    <table class="grid" style="width: 600px; margin: 3px 3px 3px 3px;">
        <thead>
            <tr>
                <th>
                    Run Dates
                </th>
                <th>
                    Frequency
                </th>
                <th>
                    Min Replicate
                </th>
                <th>
                    Max Replicate
                </th>
            </tr>
        </thead>
        <tbody>
            @Html.EditorFor(x => x.RunDatesDisplay)
        </tbody>
    </table>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Service Entry Request")
    </span><span class="rightContent">
        @Html.DropDownList("ServiceRequest", ListHelpers.YesNoList())
    </span>
</div>
<div class="bodyContent">
    <span class="leftContent">
        @Html.Label("Problem Description")
    </span><span class="rightContent">
        @Html.TextArea("ProblemDescription", new { style = "width: 600px; height: 30px" })
    </span>
</div>
@if (Model.UserRole == "Admin" || Model.UserRole == "SuperUser")
{
    <div class="bodyContent">
        <span class="leftContent">
            @Html.Label("Active")
        </span><span class="rightContent">
            @Html.CheckBoxFor(model => model.Active)
        </span>
    </div>
}
else
{
    @Html.HiddenFor(model => model.Active)
}
<p>
    <input id="LogType" type="hidden" value="Run" />
    <input id="ID" type="hidden" value="0" />
    @if (Model.ExitCode == "1")
    {
        @Html.Hidden("ExitCode", Model.ExitCode)
    }
    else
    {
        <input id="ExitCode" type="hidden" value='0' />
    }
    @if (Model.LogFileModal == "1")
    {
        <input id="LogModals" type="hidden" value='0' />
    }
    else
    {
        <input id="LogModal" type="hidden" value='1' />
    }
</p>
@Html.HiddenFor(model => model.MaxReplicateId)
@Html.HiddenFor(model => model.MinReplicateId)
@Html.HiddenFor(model => model.OutputFileName)
@Html.HiddenFor(model => model.OutputStoredFileName)
@Html.HiddenFor(model => model.LoadListFileName)
@Html.HiddenFor(model => model.LoadListStoredFileName)
@Html.HiddenFor(model => model.LogFileName)
@Html.HiddenFor(model => model.LogFileStoredName)
@Html.HiddenFor(model => model.AttachedLogFileName)
@Html.HiddenFor(model => model.AttachedMultipleLogFileNames)
@Html.HiddenFor(model => model.MinTestCompletionDate)
@Html.HiddenFor(model => model.MaxTestCompletionDate)
@Html.HiddenFor(model => model.RunLogMode)
@Html.HiddenFor(model => model.UserRole)
@Html.HiddenFor(model => model.Active)
@Html.HiddenFor(model => model.ParseType)
<div class="bodyContent">
    <span class="leftContent"></span><span class="rightContent">
        <button id="btn_create" name="submit" class="art-button" type="submit" value="Create">
            Create</button></span>
</div>

控制器动作

[HttpPost]
    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult Create(RunLogEntry runLogEntry, String ServiceRequest, string Hour, string Minute, string AMPM,
                                 string submit, IEnumerable<HttpPostedFileBase> file, String AssayPerformanceIssues1, List<string> Replicates)
    {
4

0 回答 0