I have the following modal and need to include validations so that the textarea
is required when clicking the "Yes" button, that is, it can not be sent blank, and that textarea
is at least 15 characters.
@model TClient
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
@using (Html.BeginForm())
{
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">@(Model.IsLocked ? "Desbloquear" : "Bloquear") cliente</h4>
</div>
<div class="modal-body">
<p>Deseja realmente @(Model.IsLocked ? "desbloquear" : "bloquear") o cliente <strong>@Model.Name</strong>?</p>
<div class="row">
<div class="col-lg-12">
<hr />
<div class="form-group">
<label class="control-label">
Motivo:
</label>
<div>
@this.TextArea("motivo").Class("form-control required").Rows(7).Columns(50)
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">
Não
</button>
<button type="submit" id="confirmar" class="btn btn-primary">
Sim
</button>
</div>
}
</div>
</div>
</div>