Strange Java Script Problem
Posted: Mon Aug 20, 2012 9:05 am
Dear all ,
I am trying to build a new software using nuBuilder latest version but seem stuck upon some problems as shown in the screenshot below. help would be appreciated. Thanks
The error screenshot 1 occurs when screenshot 2 is executed
my invoice JavaScript form is as below for the invoice shown in screenshot3 :
function nuLoadThis() {
calcinv_total();
}
function nuBeforeSave(){
if ( !validateCloseDate() )
return false;
calcinv_total();
return true;
}
function calclinetotal(pthis) {
if (pthis.length == 18) {
// Parameter passed through from tri_product_id
PRE = pthis;
} else {
// Parameter passed through from tri_units or tri_cost
PRE = pthis.name.substring(0,18);
}
unitCost = Number(document.getElementById(PRE+'tri_unit_cost').value);
discountCost = Number(document.getElementById(PRE+'tri_discount').value);
calcinv_total();
}
function calcinv_total() {
//calculate the entire total of all the line totals
theRows = Number(document.getElementById('rowsCourses_Invoice').value);
invAmount = '0';
invTax = '0';
//for every line...
for (int = 0;int < theRows; ++int) {
strlength = '0000'+int;
pstrlength = strlength.length;
PRE = 'Courses_Invoice' + ('0000'+int).substring(pstrlength-4);
price = Number(document.getElementById(PRE+'tri_discount').value);
//if delete is not checked then add prices
if (document.getElementById("row"+PRE).checked != true) {
invAmount = Number(invAmount) + price;
nuFormat(document.getElementById(PRE+'tri_discount'));
//else set to zero and don't add
}
}
document.getElementById('tra_amount').value = invAmount;
nuFormat(document.getElementById('tra_amount'));
}
function getRowPrefixFromLookup(pthis) {
// Needed to update row price totals if user changes a product lookup
PRE = pthis.name.substring(4,22);
nuCreateCookie('row_name_for_transaction_item', PRE, 0);
calclinetotal(nuReadCookie('row_name_for_transaction_item'));
}
I am trying to build a new software using nuBuilder latest version but seem stuck upon some problems as shown in the screenshot below. help would be appreciated. Thanks
The error screenshot 1 occurs when screenshot 2 is executed
my invoice JavaScript form is as below for the invoice shown in screenshot3 :
function nuLoadThis() {
calcinv_total();
}
function nuBeforeSave(){
if ( !validateCloseDate() )
return false;
calcinv_total();
return true;
}
function calclinetotal(pthis) {
if (pthis.length == 18) {
// Parameter passed through from tri_product_id
PRE = pthis;
} else {
// Parameter passed through from tri_units or tri_cost
PRE = pthis.name.substring(0,18);
}
unitCost = Number(document.getElementById(PRE+'tri_unit_cost').value);
discountCost = Number(document.getElementById(PRE+'tri_discount').value);
calcinv_total();
}
function calcinv_total() {
//calculate the entire total of all the line totals
theRows = Number(document.getElementById('rowsCourses_Invoice').value);
invAmount = '0';
invTax = '0';
//for every line...
for (int = 0;int < theRows; ++int) {
strlength = '0000'+int;
pstrlength = strlength.length;
PRE = 'Courses_Invoice' + ('0000'+int).substring(pstrlength-4);
price = Number(document.getElementById(PRE+'tri_discount').value);
//if delete is not checked then add prices
if (document.getElementById("row"+PRE).checked != true) {
invAmount = Number(invAmount) + price;
nuFormat(document.getElementById(PRE+'tri_discount'));
//else set to zero and don't add
}
}
document.getElementById('tra_amount').value = invAmount;
nuFormat(document.getElementById('tra_amount'));
}
function getRowPrefixFromLookup(pthis) {
// Needed to update row price totals if user changes a product lookup
PRE = pthis.name.substring(4,22);
nuCreateCookie('row_name_for_transaction_item', PRE, 0);
calclinetotal(nuReadCookie('row_name_for_transaction_item'));
}