I have this field in Model:
public decimal Valor { get; set; }
It writes correctly, and shows me the value this way:
10.00
But when I edit and complete the action, it returns me:
The field Value Paid must be a number.
I tried to add this script I saw in a tutorial to check if it solved the problem, but it still persists:
jQuery.extend(jQuery.validator.methods, {
date: function (value, element) {
return this.optional(element) || /^\d\d?\/\d\d?\/\d\d\d?\d?$/.test(value);
},
number: function (value, element)
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
}
});
HTML:
<div class="col-sm-3">
<label asp-for="ContasReceberVM.ContasReceber.Valor" class="control-label"></label>
<input asp-for="ContasReceberVM.ContasReceber.Valor" class="form-control" type="text" />
<span asp-validation-for="ContasReceberVM.ContasReceber.Valor" class="text-danger"></span>
</div>