当我尝试提交表单时出现“无效的表单控件错误”。

时间:2017-08-09 07:56:35

标签: jquery html json knockout.js

<div class="modal-body">
    <form id="createInterviewPacketForm" action="@MVC.GetLocalUrl(MVC.HireOrgJobApplication.AjaxCreateInterviewPacket(Model.Application))" method="post" class="form-horizontal">
        @Html.AntiForgeryToken()
        <input type="hidden" name="InterviewId" data-bind="value: selectedInterview().id" />
        <div class="form-group">
            <label>Cover Page Notes</label>
            <textarea name="CoverPageNotes" class="form-control" maxlength="415"></textarea>
        </div>
        <div>
            <!-- ??? create the interviewScheduleJson, use knockout data-binding -->
            <input type="hidden" name="InterviewScheduleJson" />
            <button class="btn btn-yellow" type="button" id="showmenu" style="margin-bottom: 10px">Add Day-of Schedule</button>
            <div class="menu" style="display: none;">
                <div>
                    <label>Interview Time</label>
                    <input class="form-control" type="time" data-bind="textInput: interviewScheduleTime" />
                </div>

                <label data-bind="text: (editInterviewSchedule() === null ? 'Add Icon' : 'Edit Icon')"></label>
                    <div>
                        <!-- ko foreach: interviewScheduleIconOptions -->
                        <label>
                            <input type="radio" data-bind="value: $data, checked: $root.interviewScheduleIcon" style="display:none;" required />
                            <img class="benefit-icon selectable" data-bind="attr: {src: '/content/benefits/' + $data + '.svg'}, css: {active: $data === $root.interviewScheduleIcon}" />
                        </label>
                        <!-- /ko -->
                    </div>
                    <div>
                        <label>Text</label>
                        <input type="text" class="form-control" data-bind="textInput: interviewScheduleText" maxlength="70" required />
                    </div>
                    <div>
                        <button type="button" class="btn btn-primary small-margin-top" data-bind="click: addOrEditInterviewSchedule, text: (editInterviewSchedule() === null ? 'Add' : 'Save Changes')"></button>
                        <button type="button" class="btn" data-bind="visible: editInterviewSchedule() !== null, click: resetInterviewScheduleForm">Cancel</button>
                    </div>
                <div style="display:none;">
                    <!-- invisible form for saving -->
                        <input type="hidden" name="Value" data-bind="value: JSON.stringify(interviewScheduleJson())" />
                </div>
            </div>
        </div>
        <div>
            <label>
                <input type="checkbox" name="IncludeCoverPage" value="true" checked />
                <input type="hidden" name="IncludeCoverPage" value="false" />
                Include Cover Page
            </label>
        </div>


        <div class="text-right">
            <button type="submit" class="btn btn-yellow jui-tooltip" title="Create Interview Packet">Create Interview Packet</button>
        </div>
        <p class="small-margin-top small">This generates a printable PDF interview packet for interview purposes.</p>
    </form>
</div>

我有一个看起来像这样的模态(一些代码被排除..)

enter image description here

所以当我点击“创建采访包”以及其他值(如IncludeCoverPage等)时,我的目的是提交“interviewScheduleJson”

但是当我这样做时,它给我的错误说:

An invalid form control with name='ko_unique_1' is not focusable.
An invalid form control with name='ko_unique_3' is not focusable.
An invalid form control with name='ko_unique_4' is not focusable.
An invalid form control with name='ko_unique_5' is not focusable.
An invalid form control with name='ko_unique_6' is not focusable

我是这种错误的新手。 Plz帮助!

0 个答案:

没有答案