Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Strange Java Script Problem

Post Reply
at_rcc
Posts: 32
Joined: Thu Sep 02, 2010 11:19 am

Strange Java Script Problem

Unread post by at_rcc »

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'));
}
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Strange Java Script Problem

Unread post by admin »

at_rcc,

Where is the function createJavaScriptSharedFunctions()?

Steven
at_rcc
Posts: 32
Joined: Thu Sep 02, 2010 11:19 am

Re: Strange Java Script Problem

Unread post by at_rcc »

In the Javascript Section of the Form
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Strange Java Script Problem

Unread post by admin »

at_rcc,

Before Open is for PHP, it can't call JavaScript from Javascript

Steven
Post Reply