cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe Form : detect page break using java script

prabhu_s2
Active Contributor
0 Kudos
1,876

Hi,

How can we detect a page break at a runtime using java script? I need to display a data in internal table at header and unique for a document number. i've 10 order list which has multiple items, each of the orders are printed in a new page and i wanted to know this event using a java script which could help me to add some additional logic at header.....pls can someone help on this?

Accepted Solutions (0)

Answers (2)

Answers (2)

pavan_prabhu
Active Participant
0 Kudos

Hello Prabhu,

     From your doubt, what I understand is that, You have designed a header in Master Page. You need to fill this header using the Item table which is already designed in the design view(body page). Means you want to fill the Item details(which are in body page) into the header(which is in the master page).

To read the contents from body page into master page, you need to write Javascript code on the header fields(which is in the master page) in the Layout Ready Event.

For example, if you want to fill the field Order_description in header(master page) from the column Order_Description which is in the Item table(body page)

In the form layout, select the order_description field and in the event READY LAYOUT write the below JavaScript code.

var currpage = xfa.layout.page(this);------> Get the current page

var fields = 0;------> Variable to store the number of fields in that page.

fields = xfa.layout.pageContent(currpage-1, "field", 0); ------> Get the number of fields


for ( i=0; i<= fields.length-1; i++ ) ------> Loop on each field on the page


{

  

    if ( fields.name == "ORDER_DESCRIPTION" ) ------> Check if the corresponding field is in the Item table

 

      {


         this.rawValue = fields.item(i).rawValue; ------> Assign that value in the Header field


      }

}

Repeat the same steps for other fields in the Header. This will work for all Purchase Orders spanned across multiple pages.


prabhu_s2
Active Contributor
0 Kudos

I have fixed it using page contents and global variables. ...thanks all for ur input

former_member210857
Participant
0 Kudos

Hi Pavan,

I have a similar requirement ...I need to change the storage location in the header (master page ) to change  as the item storage location changes .

I have tried the code ? It is not working .My doubt is should i Bind the header field to some field  ?

Thanks and Regards,

Subeesh Kannottil

former_member210857
Participant
0 Kudos

Hi Prabhu,

Can you let me know how you did this ?

Regards,

Subeesh kannottil

navip
Active Participant
0 Kudos

Not sure about achieving your requirement, but do some R&D on the below script, you may get some idea...

this.rawValue = xfa.layout.page(this);


---

Naveen

prabhu_s2
Active Contributor
0 Kudos

thanks naveen but i had already tried this out and infact wont fit my requirement. i am still looking for options....

my program picks Pur.Ords and its line items. the form was already designed to print the PO header in the mainpage followed but its items and this repeats for each new PO where new PO are printed in the following new page. there is a requirement for me to print an item from the PO header to the header designed in master page and to do it i tried with the below script which works for a single PO but not for multiple ones especially when a single PO spans across multiple pages.

var lineno = xfa.layout.page(this);

var path = "xfa.record.PHead.DATA["+(lineno-1)+"].Print";

var tab =  xfa.resolveNode(path);

this.rawValue = tab.nodes.item(lineno-1).Allocate.value;

prabhu_s2
Active Contributor
0 Kudos

Hi,

Is there a way to keep the variables static and increase it from previus state rather than been initiated within the script?