켜기 버튼 btnClick
빈 MedicineName
텍스트 필드가있는 양식을 제출하면 사용자에게 알리고 싶습니다. MedicineName
texbox 값이 비어 있으면 팝업이 아니라 숨기기를 의미합니다.On 버튼 texbox 값이 비어 있으면 클릭 asp.net mvc를 사용하여 경고 표시?
<div class="col-lg-4">
<fieldset class="form-group">
<label class="form-label" for="exampleInput">MedicineName</label>
@*@Html.TextBoxFor(model => Model.MedicineName, new { @class = "form-control", @id = "txtMedicineName", placeholder = "MedicineName" })*@
<div class="typeahead-container">
<div class="typeahead-field">
<span class="typeahead-query">
@Html.TextBoxFor(model => Model.prescriptionmanagement.MedicineName, new { @class = "form-control", @id = "txtMedicineName", placeholder = "Medicine Name", name = "d", type = "search", autocomplete = "off" })
<input type="hidden" id="hfCustomer" name="CustomerId" />
</span>
</div>
</div>
@Html.ValidationMessageFor(model => Model.prescriptionmanagement.MedicineName, null, new { @style = "color: red" })
</fieldset>
</div>
<div class="col-lg-4">
<fieldset class="form-group">
<label class="form-label" for="exampleInput">Drug Specifications</label>
<div class="tbl-cell tbl-cell-action button">
<a href="#" data-toggle="modal" id="btnClick" data-target="#upload3Modal" class="btn btn-rounded btn-block">Drug Specifications <span class="font-icon-search"></span></a>
</div>
</fieldset>
</div>
왜 당신은 당신의 속성에'[필수]'속성을 추가하고 '@Html을 포함하여이 일을하지 않습니다. ValidationMessageFor()'클라이언트 및 서버 측 유효성 검사를 모두받을 수 있도록 –
ValidationMessageFor는 id = "btnClick"을 클릭하면 팝업이 빈 텍스트 상자 @StephenMuecke와 함께로드됩니다. –
잘 작동한다면 왜 지구상에 팝업이 필요한지? 오류 메시지는'ValidationMessageFor()'자리 표시 자에 표시 될 것입니다. 폼의'.submit()'이벤트를 처리하고'$ (this) .valid()'의 값을 테스트하고 AYax 호출을 취소하면 –