このエラー メッセージが表示され続けます。
<script src="../../Scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.23.custom.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#formEmployee").validate({
rules: {
EmployeeModel_Name: "required"
},
messages: {
EmployeeModel_Name: "Please specify your name"
}
})
$("#btnSave").click(function () {
$("#formEmployee").valid();
});
});
@using (Html.BeginForm(null, null, FormMethod.Get, new { name = "formEmployee", id = "formEmployee" }))
{
<fieldset>
<legend>EmployeeModel</legend>
@Html.EditorFor(model => model.EmployeeModel.Name, new { @class = "required" })
<p>
<input id="btnSave" type="button" value="Save" />
</p>
</fieldset>
}
生成されたhtml
<form action="/Dealer/ManageEmployee" id="formEmployee" method="get" name="formEmployee"> <fieldset>
<legend>EmployeeModel</legend>
<div class="editor-label">
<label for="EmployeeModel_Name">Name</label>
</div>
<div class="editor-field">
<input class="text-box single-line" id="EmployeeModel_Name" name="EmployeeModel.Name" type="text" value="">
</div>
<p>
<input id="btnSave" type="button" value="Save">
<input id="btnBack" type="button" value="Back">
</p>
</fieldset>
</form>