我在我的模型上使用 DataAnnotations 并且 JavaScript 验证工作正常,但我现在需要在验证无效时禁用提交按钮
这是我试图开始工作的一些示例代码
<h2>
Index</h2>
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<fieldset>
<legend>HomeModel</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Description)
@Html.ValidationMessageFor(model => model.Description)
</div>
<p>
<input type="submit" value="Save" id="submit-button" />
</p>
</fieldset>
}<div>
@Html.ActionLink("Back to List", "Index")</div>@section Scripts { @Scripts.Render("~/bundles/jqueryval")}