Cumulative page total calculation javascript code in Adobeforms

Hi, when there were more than 2 or 2 pages in the output of invoice, delivery note etc. adobe forms, I was asked to accumulate the amount of the previous pages and write them on each page.

Add a textfield that will remain static in the MasterPage section, type the following code in the Layout: Ready section of that textfield’s javascript code, change the NETWR (this field that will be in DesignView) field according to your own.

var toplam_sayfa = xfa.layout.pageCount();
var simdiki_sayfa = xfa.layout.page(this);
var sayfa_toplam = 0;
var alanlar = 0;
simdiki_sayfa = simdiki_sayfa-1;
for ( i = 0; i <= simdiki_sayfa-1; i++ ){
    alanlar = xfa.layout.pageContent(i, "field", 0);
    for ( j=0; j<= alanlar.length-1; j++ ){
        if (alanlar.item(j).name == "NETWR"){
            sayfa_toplam = sayfa_toplam + alanlar.item(j).rawValue;
        }
    }
}
this.rawValue = sayfa_toplam;

Leave a Reply

Your email address will not be published. Required fields are marked *