1
I am trying unsuccessfully to make Maskmoney load the format value when entering the page, I know there is a link right here in the OS with a similar question, but even with the example I am not getting.
The value in my comic book is recorded like this:
In the bank the field is defined thus:
My input is like this:
<input type="text" id="UpUltimoSalario" name="UpUltimoSalario" value="" class="form-control" >
And what I’ve tried so far:
// MÁSCARA PARA VALORES $(function() { var maxLength = '-0.000.000,00'.length; $("#UpUltimoSalario").maskMoney({ // allowNegative: true, decimal: ',', thousands: '.', affixesStay: false }) .attr('maxlength', maxLength).trigger('mask.maskMoney'); });
When I open my modal the value is like this:
Clicking on the input looks like this:
Inserting value returned in Modal:
// INSERINDO REGISTROS NA MODAL - ALTERAÇÃO function Alteracao(Historico) { $.post("pDetalhesHistoricoProfissional-2-bkp.php", { Historico: Historico }, function (data, status) { // PARSE json data var dados = JSON.parse(data); // CHAVES PARA ALTERAÇÃO $("#IdHistorico").val(dados.IdHistorico); $("#IdCandidato").val(dados.IdCandidato); // CARREGA VALORES NA MODAL $("#UpEmpresa").val(dados.Empresa); $("#UpCargo").val(dados.Cargo); $("#UpDataEntrada").val(dados.DataEntrada); $("#UpDataSaida").val(dados.DataSaida); $("#UpUltimoSalario").val(dados.UltimoSalario); $("#UpAtividades").val(dados.Atividades); } ); // ABRE MODAL PARA ALTERAÇÃO $("#ModalAlteracao").modal("show"); }
When pulling the value of the bank, it makes 2 Replaces: the first taking out all the points, and the second replacing the comma with a point. This in the back-end.
– Sam
If the problem is with Maskmoney, which is in Javascript, the problem can and should be reduced to a [mcve] that does not depend on PHP. You can just cite that the value that arrived from the database was X and from that mount the problem only with the JS. The entire PHP snippet of the question is unrelated to the problem and is only polluting your question.
– Woss