1
I have the following modal and need to include validations so that the textarea
is mandatory when clicking the "Yes" button, that is, it cannot be sent in white, and so that the textarea
has 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>
You are using jQuery.Validate?
– Leonel Sanches da Silva
@Ciganomorrisonmendez I believe so, because there are several validations in the application that I work in javascript, jquery, etc. What would be your proposal for the questions? 'Cause I haven’t found anything about it so far
– Felipe Negro
I don’t understand what it is here:
@this.TextArea("motivo").Class("form-control required").Rows(7).Columns(50)
. You can edit your question with the source code of these methods?– Leonel Sanches da Silva
@Ciganomorrisonmendez is where I create the Textarea with Razor, in MVC 4
– Felipe Negro