我在我的asp.net mvc web應用程序內有以下視圖,根據輸入的IP和/或MAC進行搜索: -如何實現一個必需的驗證,以檢查用戶是否輸入至少一個值
@using (Ajax.BeginForm("AdvanceSearchIndex","Home",
new AjaxOptions
{
HttpMethod = "get",
InsertionMode = InsertionMode.Replace,
LoadingElementId = "progress",
UpdateTargetId = "SearchTable"
}))
{
<div>
<span class="f">IP Address </span>
@Html.EditorFor(model=>model.ip)
@Html.ValidationMessageFor(model => model.ip)
</div>
<div>
<span class="f">MAC Address </span>
@Html.EditorFor(model=>model.mac)
@Html.ValidationMessageFor(model => model.mac)
</div>@*
<input class="btn btn-success" type="submit" value="search" />
<img src="~/Content/Ajax-loader-bar.gif" class="loadingimage" id="progress2" />
}
但有沒有辦法來檢查用戶是否輸入IP或MAC或兩者都點擊搜索按鈕時,我需要一種方法來檢查這一個客戶端和服務器端。誰可以建議?
研究javscript/jQuery驗證的客戶端。可 – charlietfl