Friends,
When I'm using compare validate fail even if correct because equalto bring a empty value to comparation I don't find any solution to this problem... The problem occurred at client side validation using validatejs.
This is my model:
[Required]
[StringLength(100, ErrorMessage = "A {0} deverá possuir {2} caracteres.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Senha")]
public string Senha { get; set; }
[DataType(DataType.Password)]
[Display(Name = "ConfirmSenha")]
[Compare("Senha", ErrorMessage = " O campo senha não corresponde a sua confirmação")]
public string ConfirmSenha { get; set; }
here is my view:
<div class="row">
<div class="form-group col-sm-6">
<label>Senha *</label>
@Html.TextBoxFor(m => m.Senha, new { @class = "form-control required", type = "Password" })
@Html.ValidationMessageFor(m => m.Senha, "", new { @class = "text-danger" })
</div>
<div class="form-group col-sm-6">
<label>Confirmação de senha *</label>
@Html.TextBoxFor(m => m.ConfirmSenha, new { @class = "form-control required", type = "Password" })
@Html.ValidationMessageFor(m => m.ConfirmSenha, "", new { @class = "text-danger" })
</div>
</div>