0
I’m trying to put a value on the inside of a input which is masked both in typing and in the entered value.
Well, I have a list of real estate listings in the database that I pull to the front, okay?
And not going into too many specifications, whenever I enter a value in INPUT (Ex.: 100.000,00
) it comes peaceful formatted, however when I click "Save" (from my system, irrelevant now) the value of the input changes to 100.00
. Below is the front code:
<div class="col-md-4">
<div class="form-group">
<label class="bold label-color-cinza">Preço</label>
<input type="text" maxlength="" class="form-control input-sm moeda" name="valor" value="<?= $imovel->valor ?>" placeholder="Preço">
</div>
Please, I’m trying everything and it always comes to this. Below the code of the Mask:
$('.moeda').mask('999.999.999,99');
Is inside a ready quiet, quiet, quiet here.
Again, my problem is:
- I cannot fix the input value with the saved input value.
Grateful to all who can help!!!
EDIT 1: After some suggestions from you the problem persisted. The mask in the typing is great. I always test using the value 100,000.00 and the printed result is 100.00.
100.000,00 => 100,00
10.000,00 => 10,00
1.000.000,00 => 1,00
They saw that he was always taking the digits before the first point and adding the ",00" [End EDIT 1]
Try to change Mask and use it like this: $('. currency'). Mask("#. #0,00", {Reverse: true});
– Lucas de Carvalho
I’m sorry bro, but the problem persists... The mask in the typing is fine, but when I save it changes the value, as I said above, I always test using 100.000,00 and when giving the "save" the value changes to 100,00 and every time I increase a zero in the typing, it decreases 1 zero in the number that gets printed.
– Lougans de Matos