I'm going through a problem I've never seen before. I'm hoping someone has seen and can help me.
I'm working with asp.net mvc 5, and sending a form via post to my controller.
My model:
<div class="col-md-6">
<form action="@Url.Action("Create","DadosManuais")" method="get" class="form-horizontal">
meus campos aqui...
</div>
My controller:
public ActionResult Create(DadosManuaisCreate dados){
Algumas linhas de código...
}
I'm also using jquery to create the masks in the model:
@section Scripts{
@Scripts.Render("~/bundles/jqueryval")
<script type="text/javascript">
$(document).ready(function () {
$("#periodo").inputmask("mm/yyyy");
$("#tacGestor").maskMoney({ showSymbol: true, symbol: "R$",
decimal: ",", thousands: "." });
$("#vlEsperado").maskMoney({ showSymbol: true, symbol: "R$",
decimal: ",", thousands: "." });
$("#vlAdquirido").maskMoney({ showSymbol: true, symbol: "R$",
decimal: ",", thousands: "." });
$("#selic").maskMoney({ showSymbol: true, symbol: "R$", decimal:
",", thousands: "." });
$("#premioSelic").maskMoney({ showSymbol: true, symbol: "R$",
decimal: ",", thousands: "." });
$("#seguro").maskMoney({ showSymbol: true, symbol: "R$",
decimal: ",", thousands: "." });
$("#despesas").maskMoney({ showSymbol: true, symbol: "R$",
decimal: ",", thousands: "." });
$("#naoIdentificados").maskMoney({ showSymbol: true, symbol:
"R$", decimal: ",", thousands: "." });
$("#qtdContratosAtivos").inputmask("9{1,3}.9{1,3}.9{1,3}");
});
</script>
}
Note that at the end of the command in jquery, there is a parameter " thousands:". "} "
This says that for thousands, the dot (".") will be used to divide.
My problem happens when I press the submit button. the object is instantiated per parameter in the controller, but fields containing numbers larger than 999.99 are zeroed.
Look:
Iremovedtheparameter" thousands:". "} " and the problem stopped occurring:
How to work around this problem without removing my mask?
Very grateful!
PS: No data posted here is real. They are all used to simulate an insert in the system.