Hi guys need some help here.
I don't know why but it doesn't read the value.
This is to be runned by Property.
function calculate_form_opap(op_id,oca_id,ocp_id) {
var propertiesintotal=0;
var total=0;
var completo='';
var completo_count = op_id+'_'+oca_id;
propertiesintotal = Number(document.getElementById('propertiesintotal_'+op_id+'_'+oca_id).value);
propertiesintotal=propertiesintotal-1;
for (y=0; y<=propertiesintotal; y++){
completo=op_id+'_'+oca_id+'_'+ocp_id+'_'+y;
alert(completo);
//valor = document.getElementById('property_total_'+completo).value;
valor = $("#property_total_"+completo).val();
if(!valor){
valor=0;
}
total = (Number(total) + Number(valor));
alert(total);
}
$('#order_qty_total_'+completo_count).val(total);
$('#po_qty_'+completo_count).val(total*Number($('#masterq_'+op_id).html()));
$('#total_'+completo_count).val((total*Number($('#packprice_'+op_id).html())).toFixed(2));
}
And give me:
document.getElementById(
[Break on this error] valor = document.getElementById('property_total_'+completo).value;
I was also trying using jQuery:
valor = $("#property_total_"+completo).val();
It gets the value! But the thing is that if I insert a new value inside another input, it doesn't read the previous value anymore.
See image here just to have a feel of what im talking,
[IMG]http://www.drosendo.com/jserror.jpg[/IMG]
Example: I put 4 in Black / Blue - Medium input box
Result is: 0| 4 | 0 | 0
Then i put the 5 in Black / Blue - Large input box
Result: 0| 0| 5 | 0
The result should be:
0 | 4 | 5 | 0
Giving me total = (Number(total) + Number(valor); result 9
Please help.