mvc пропустить элемент Max, если элемент Min пуст - PullRequest
0 голосов
/ 18 января 2019

Работа над MVC5 c # Entity Framework Project, в котором пользователь вводит серию значений 40 мин / макс. Пользователь хотел бы, чтобы TAB пропустил файл Max, если поле Min не заполнено или не имеет значения null, и перейдите к элементу Next Min. Это поведение в текущем приложении, которое мы конвертируем в MVC / Entity Framework, и оно, если возможно, хотело бы воспроизвести это поведение.

Пример кода содержит 3 столбца на строку полей Min / Max. Порядок табуляции находится внизу столбца и использует tabindex в операторе EditorFor, чтобы заставить работать порядок табуляции.

Мы просто хотим, чтобы он пропустил файл Max и перешел к следующему полю Min, если это возможно. Спасибо за любую помощь или направление.

 <div class="form-horizontal">

    <div class="form-group">
        @Html.LabelFor(model => model.F_MNI3, htmlAttributes: new { @class = "control-label col-md-1" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNI3, new { htmlAttributes = new { @class = "form-control", tabindex = 2 } })
            @Html.ValidationMessageFor(model => model.F_MNI3, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @*  @Html.EditorFor(model => model.A_NAME, new { htmlAttributes = new { @onchange = "OnChangeEvent(this)", tabindex = 2 } })  *@
            @Html.EditorFor(model => model.F_MXI3, new { htmlAttributes = new { @onchange = "OnChangeEvent(this)", @class = "form-control", tabindex = 3 } })
            @Html.ValidationMessageFor(model => model.F_MXI3, "", new { @class = "text-danger" })
        </div>

        @Html.LabelFor(model => model.F_MNN8, htmlAttributes: new { @class = "control-label   col-md-1" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNN8, new { htmlAttributes = new { @class = "form-control", tabindex = 22 } })
            @Html.ValidationMessageFor(model => model.F_MNN8, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXN8, new { htmlAttributes = new { @class = "form-control", tabindex = 23 } })
            @Html.ValidationMessageFor(model => model.F_MXN8, "", new { @class = "text-danger" })
        </div>


        @Html.LabelFor(model => model.F_MNDUST, htmlAttributes: new { @class = "control-label    col-md-3" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNDUST, new { htmlAttributes = new { @class = "form-control", tabindex = 50 } })
            @Html.ValidationMessageFor(model => model.F_MNDUST, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXDUST, new { htmlAttributes = new { @class = "form-control", tabindex = 51 } })
            @Html.ValidationMessageFor(model => model.F_MXDUST, "", new { @class = "text-danger" })
        </div>

    </div>



    <div class="form-group">
        @Html.LabelFor(model => model.F_MNI2HALF, htmlAttributes: new { @class = "control-label col-md-1" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNI2HALF, new { htmlAttributes = new { @class = "form-control", tabindex = 4 } })
            @Html.ValidationMessageFor(model => model.F_MNI2HALF, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXI2HALF, new { htmlAttributes = new { @class = "form-control", tabindex = 5 } })
            @Html.ValidationMessageFor(model => model.F_MXI2HALF, "", new { @class = "text-danger" })
        </div>

        @Html.LabelFor(model => model.F_MNN10, htmlAttributes: new { @class = "control-label   col-md-1" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNN10, new { htmlAttributes = new { @class = "form-control", tabindex = 24 } })
            @Html.ValidationMessageFor(model => model.F_MNN10, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXN10, new { htmlAttributes = new { @class = "form-control", tabindex = 25 } })
            @Html.ValidationMessageFor(model => model.F_MXN10, "", new { @class = "text-danger" })
        </div>


        @*  @Html.LabelFor(model => model.F_MNCRUSH, htmlAttributes: new { @class = "control-label  col-md-offset-1  col-md-2" }) *@
        @Html.LabelFor(model => model.F_MNCRUSH, htmlAttributes: new { @class = "control-label   col-md-3" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNCRUSH, new { htmlAttributes = new { @class = "form-control", tabindex = 52 } })
            @Html.ValidationMessageFor(model => model.F_MNCRUSH, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXCRUSH, new { htmlAttributes = new { @class = "form-control", tabindex = 53 } })
            @Html.ValidationMessageFor(model => model.F_MXCRUSH, "", new { @class = "text-danger" })
        </div>

    </div>


    <div class="form-group">
        @Html.LabelFor(model => model.F_MNI2, htmlAttributes: new { @class = "control-label col-md-1" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNI2, new { htmlAttributes = new { @class = "form-control", tabindex = 6 } })
            @Html.ValidationMessageFor(model => model.F_MNI2, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXI2, new { htmlAttributes = new { @class = "form-control", tabindex = 7 } })
            @Html.ValidationMessageFor(model => model.F_MXI2, "", new { @class = "text-danger" })
        </div>

        @Html.LabelFor(model => model.F_MNN16, htmlAttributes: new { @class = "control-label   col-md-1" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNN16, new { htmlAttributes = new { @class = "form-control", tabindex = 26 } })
            @Html.ValidationMessageFor(model => model.F_MNN16, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXN16, new { htmlAttributes = new { @class = "form-control", tabindex = 27 } })
            @Html.ValidationMessageFor(model => model.F_MXN16, "", new { @class = "text-danger" })
        </div>


        @Html.LabelFor(model => model.F_MNDENS, htmlAttributes: new { @class = "control-label    col-md-3" })
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MNDENS, new { htmlAttributes = new { @class = "form-control", tabindex = 54 } })
            @Html.ValidationMessageFor(model => model.F_MNDENS, "", new { @class = "text-danger" })
        </div>
        <div class="col-md-1">
            @Html.EditorFor(model => model.F_MXDENS, new { htmlAttributes = new { @class = "form-control", tabindex = 55 } })
            @Html.ValidationMessageFor(model => model.F_MXDENS, "", new { @class = "text-danger" })
        </div>

      </div>

  </div>
...