cancel
Showing results for 
Search instead for 
Did you mean: 

access body page node index from correspondent masterpage

0 Kudos

Why

I have a repetable form in a body page for a table and after each form i have a pge break. Since each body page will have a masterpage instances, how can i know the body page form index (table line beeing processed ) inside de masterpage event?

best regards

Message was edited by: miguel arcanjo

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi, Myself

I think you must be crazy por speaking to yourself but still in case anyone any alien read this i'd like him/it to know that since i could not tell the correspondent context (body page) binding index, i worked around using the xfa.layout.pageContent in the masterpage events for reading the pages before and after.

Best regards

Answers (1)

Answers (1)

0 Kudos

I have an table with workers data i want to show. I created a "Main" page with the table binding and multiple occurence and its working great but (there's always a but ) in my master page i want to know the value of a field in the "Main" body page.

in the masterpage calculate event, when trying to acess the body page field i've used the $form.data.MAIN.fd_number.rawValue but the value is always the first occurence.

            using $record.data.GV_NUMBER.value returns nothing.

            xfa.resolveNodes( data.MAIN.fd_number).rawvalue also returns nothing

 

What am i doing wrong? Any ideas?

Thanks

Miguel

pavan_prabhu
Active Participant
0 Kudos

Hello Miguel,

     If in your master page you want to know the value of a field which in the body page, you need to write Javascript manually in Ready Layout event of a any of the text field which is in the master page. xfa.resolvenode will return NULL.


What you should is write the below Javascript code in Ready Layout event on any field which is in the master page.


For example, lets try to fetch the value of COLUMN1 which is in a table in body page and try to put this value in the field TEXT_FIELD1 which is in master page.


In the form layout, select the field (TEXT_FIELD1) in the master page and in the event READY LAYOUT write the below JavaScript code.


Note - If there are N records in the table, this event will be triggered N times only for this field alone. So you can directly map the corresponding column value and assign it in your master page field.

Get the current page

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

Variable to store the number of fields in that page

var fields = 0;

From current page, get the total number of fields which are in both master page and body page

fields = xfa.layout.pageContent (currpage-1, "field", 0);

Loop on each field on the page

for ( i=0; i<= fields.length-1; i++ )


  {


     Check if the field is present in the table of body page

     if ( fields.name == "COLUMN1" )


      {

           Assign that value to the field(TEXT_FIELD1) in master page

           this.rawValue = fields.item(i).rawValue;           

      }


  }



Note: This code will pick up all the instances of the table sub form from body page into master page because you are accessing the values directly after the layout is rendered.

0 Kudos

Hi Pavan,

Thanks for you response but that's just what i said i've done (in my previous reply). Its working but i wonder if there isn't a better solution then reading all the fields from every page (since its a pdf that will have 500pages).

I'll just keep the post open for a while, just in case a better anwser shows.

Best regards