-1
I’m creating a mask in my field like this:
$("#ValorMultaSt").mask('000.000.000,00', { reverse: true });
When I type some value works perfectly, but when I perform any action on the screen it puts a "." in front, as in the example:
If I type 444,44
after performing an action on the screen the value is changed to .444,44
Javascript function:
function AtualizarMascaras() {
// Mascaras
$("#ValorPorcentagemField").mask('000', { reverse: true });
$("#ValorMultaSt").mask('000.000.000,00', { reverse: true });
$("#ValorMultaAcrescimoSt").mask('000.000.000,00', { reverse: true });
$("#ValorMultaFaixaMinimaSt").mask('000.000.000,00', { reverse: true });
$("#ValorMultaFaixaMaximaSt").mask('000.000.000,00', { reverse: true });
$("#DataPublicacao").mask('00/00/0000');
}
Function calling mask update function:
$(function () {
$(document).ajaxComplete(function () {
AtualizarMascaras();
});
AtualizarMascaras();
});
Div html from the field:
<div class="row" id="divValorMulta">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<div class="form-group">
<div class="row">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
@Html.LabelFor(model => model.ValorMultaSt, "Valor da Multa")
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
@Html.EditorFor(model => model.ValorMultaSt, new { htmlAttributes = new { @class = "form-control", disabled, @placeholder = "R$" } })
</div>
</div>
</div>
</div>
</div>
Someone can help me?
Use the Jquery-maskMoney plugin. See Here
– 8biT
What "action" would that be?
– Sam
no, already removed and continues the same error
– Stand Alone
At what point is this code executed? Post this excerpt as well, in your question. What type of action causes the value to be changed incorrectly?
– Pedro Gaspar
Any action you take Ubmit to the screen....
– Stand Alone
"Reverse: true" is to put the mask from right to left.
– Netinho Santos
Try to simulate here or in jsfiddle.
– Netinho Santos
@Netinho Santos, already removed, the error remains...
– Stand Alone
It is not "Reverse: true" that is causing the error. As I said, it is to put the mask from right to left. Try to simulate here by putting the full code.
– Netinho Santos
posted the complete code...
– Stand Alone
Put the already rendered HTML in the browser.
CTRL + U
– Guilherme Rigotti
<input class="form-control text-box single-line" id="Valormultast" name="Valormultast" placeholder="R$" type="text" value=" 333,33" maxlength="14" autocomplete="off">
– Stand Alone