How to do Aritmetical Operations with values Obtained from Calculations Fields
Hi Everybody, i´m taken the value of a couple of calculations fields from differents forms , but when try to do an algebraical operation the result is a value like NaN, when evaluate the type the value that i get from the fields i note that it is a string, so i decide use the function Number() to try to convert the value but it don´t work.
the question is: really it is the expected behavior when i get values from calculations fields? , in other hand why the function Number() don´t convert the values correctly?
<h3>Nota: Todo abono a la factura será revisado por el departamento de finanzas. .</h3>
<!-- Javascript JQuery to substring string -->
<script type = "text/javascript" >
var field1 = Number(FormUtil.getField("totalmonto"));
//var a = Number(field1.val());
// function updateField(){
var amount = 0
//amount = $(FormUtil.getField("totalmonto")).val() - $(FormUtil.getField("abono")).val();
amount = $(FormUtil.getField("totalmonto")).val() - 50 ;
// var amount = $(FormUtil.getField("totalmonto")).val();
$(FormUtil.getField("calculo")).val(amount);
// }
$(function(){
$(FormUtil.getField("totalmonto")).change(function(){
updateField();
});
$(FormUtil.getField("total_abonado")).change(function(){
updateField();
});
});
//Almacenar en Formulario
// FormUtil.getField(fieldId1).val("total");
// var field = $("#IVA").val();
// To Debug
window.alert(field1);
window.alert(amount);
// console.log("x");
// document.write(5 + 6);
//});
</script>
