I'm using a Remark component that has a data-plugin="formatter"
in which to apply a zip mask in field
. The field
has size of 8 characters, but with the mask it gets 9 because of "-"
(Ex: 29780-000). When saving the registry, JavaScript Validation
performs client-side validation and does not allow the post because of the amount of characters.
ViewModel:
[DisplayName("CEP")]
[Required(ErrorMessage = "O campo CEP é obrigatório")]
[MaxLength(8, ErrorMessage = "O campo {0} deve ter no máximo {1} caracteres")]
public string CEP { get; set; }
View:
<div class="col-md-2">
<label asp-for="PessoaFisicaViewModel.PessoasFisicasEnderecosViewModel[i].CEP" class="control-label lb-cep">CEP</label>
<input type="text" asp-for="PessoaFisicaViewModel.PessoasFisicasEnderecosViewModel[i].CEP" data-plugin="formatter" data-pattern="[[99999]]-[[999]]" class="form-control txt-cep" />
<span asp-validation-for="PessoaFisicaViewModel.PessoasFisicasEnderecosViewModel[i].CEP" class="text-danger validation-cep"></span>
</div>
Is there any configuration or way to get only numbers to be sent when giving post
? In Desktop applications it is possible to configure the mask not to be written, but in app web
I do not know if it has. Does anyone know how to help me?
Thank you! :)