0
I’m using the library jquery.maskMoney.js to format the system’s monetary data. But when data is saved in the database and returned to the system screen formatting is lost. How to resolve this problem? I would like the formatting to remain, follow some system screens that exemplify this problem.
1. Data with monetary formatting: inserting the data into the forms
2. Data without monetary formatting: data being loaded from the database
3. Excerpt from the page code edita.blade.php
<div class="col-md-5 form-group">
<label class="control-label">Valor Solicitado (R$)</label>
<input type="text" class="form-control" id="vlSolicitado" name="vlSolicitado" value="{{str_replace('.',',',$projeto->valor_solicitado)}}" data-thousands="." data-decimal="," data-prefix="R$ " maxlength="18" required>
</div>
has a function in php: number_format($field['valorprod'], 2, ',', ''), where goes the variable you want to format, the number of boxes after the comma, the separation element ("," or "." ) and the separation of thousands "> 1000,00 (without space) or " > 1 000,00 (with space)
– Gabriel Gonçalves
Voce can save a way, only using numbers and then when it shows treat the value so that it is shown as Voce you want.
– Luís Almeida
To solve the problem, apply the mask on the return of the data after modifying and saving.
– Daniel Omine