1
I have the following form:
My goal is to take the value Total and when selecting the field of interest or discount, calculate with this value with the value Total (if there is interest or discount) and this result, calculate with the value of installments (if selected) and the final value appears in the Final value fields and the value of the plots already calculated in the value of the plots.
This is possible with jquery or javascript?
The code goes below:
<div class="form-group"><label>Valor Total: </label><input type="text" class="form-control" value="R$ <?php echo number_format($peTotalAberto->ValorTotal,2,",","."); ?>" readonly></div>
<div class="form-group">
<div class="col-md-12">
<input type="radio" name="JurosDesconto" onclick="desabilitarJurosDesconto(0)"> <label>Juros: <small>Cobrar após o vencimento</small></label>
<div class="input-group" style="width: 30%">
<input type="number" name="Juros" id="juros" class="form-control" min="0" max="100" value="0" onKeyPress="if(this.value.length==2) return false;" disabled>
<span class="input-group-addon" id="basic-addon2">%</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input type="radio" name="JurosDesconto" onclick="desabilitarJurosDesconto(1)"> <label>Desconto:</label>
<div class="input-group" style="width: 30%">
<input type="number" name="Desconto" id="desconto" class="form-control" min="0" max="100" value="0" onKeyPress="if(this.value.length==2) return false;" disabled>
<span class="input-group-addon" id="basic-addon2">%</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input type="checkbox" name="QTDParcelas" id="qtdParcelas" onclick="desabilitarQtdParcelas()"> <label>Qtd. de parcelas:</label>
<div class="input-group" style="width: 30%">
<input type="number" name="QuantidadeParcelas" id="parcelas" class="form-control" min="0" max="100" value="0" onKeyPress="if(this.value.length==2) return false;" disabled>
</div>
</div>
</div>
<div class="form-group" style="margin-top: 10px">
<label for="nomealuno" class="control-label">Valor Final: <span style="color: red">*</span></label>
<input type="text" name="ValorFinal" id="valorFinal" class="form-control" required="required">
</div>
<div class="form-group">
<label for="nomealuno" class="control-label">Valor das parcelas: <span style="color: red">*</span></label>
<input type="text" name="ValorParcelas" id="valorParcelas" class="form-control" required="required">
</div>
If your goal is only to show the result of operations on the screen, yes.
– Deividson Oliveira
Hello Deividson. Could you show me an example? Because I’m not very good at Jquery and Javascript.
– user24136
Place the html for the page to make it easy to mount an example
– Leonardo Barros
That carelessness my Leonardo. I really forgot to include the HTML. I made the adjustment in the Post. Thank you for paying attention to this detail.
– user24136