如何在复选框组中进行空验证,以便在MVC中的java脚本中提交事件

时间:2015-07-21 09:06:43

标签: javascript asp.net-mvc-5

@model TechCourier.Customer.BO.CustomerAddressBO

@using (Html.BeginForm("CreateAddress", "Customer", new { @onsubmit = "check(this.form.AddressType)" }))
{
  @Html.ValidationSummary(true)
  <fieldset>
    <table>
      <tr>
        <td></td>
        <td>
          <div class="editor-field">
            @Html.HiddenFor(model => model.AddressID)
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="2">
          @{Html.RenderAction("Address", "Address", new { addressID = 0 });}
        </td>
      </tr>
      <tr>
        <td class="TextLeft">
          @Html.Label("Address Type")
          @Html.ValidationMessage("Addresstype")
        </td>
        <td>
          <div id="check">
            @foreach (var item in ViewBag.AddressTypeID)
            {
              <br />
              <input type="checkbox" name="AddressType" value="@item.AddressTypeID" />@item.AddressType
            }
          </div>
        </td>
      </tr>
      <tr>
        <td>
          <input type="hidden" name="CustomerID" value="@ViewData["CustomerID"]" />
        </td>  
      </tr>
    </table>
  </fieldset>
}

<script>
</script>

这是我的剃刀部分弹出视图。在这里,我想对javascript中的复选框组进行null客户端验证以进行提交事件。我做了弹出式jquery和自定义的html助手,所以在htlm帮助器中提交按钮自定义。

0 个答案:

没有答案