Form title not printed on last page Adobe Form | Community
Skip to main content
Level 2
April 7, 2026
Solved

Form title not printed on last page Adobe Form

  • April 7, 2026
  • 2 replies
  • 27 views

Hi Experts,

 

In my form on the last page (so in my example 3 pages) it will never print the form title and order number. 

 

The following script is in place to determine of there are more pages:

 

 Form.frmHiddenGlobalFields.txtFormTitle::ready:layout - (FormCalc, client)

// Set the form title as the combination of title and document ID, separated by colon 

//First Page (always available)
if (HasValue(txtChangedDocument.rawValue) == 0)
then
  xfa.resolveNode(Concat("#pageSet[0].mst1.FirstPage.frmHeader.txtTitle")) = Form.frmHiddenStaticTexts.lblSalesOrder.rawValue
//  xfa.resolveNode("#pageSet[0].mst1.FirstPage.frmHeader.txtTitle") = Concat(Form.frmHiddenStaticTexts.lblSalesOrder.rawValue, ": ", Form.frmHiddenGlobalFields.txtDocumentID.rawValue)
else
  xfa.resolveNode(Concat("#pageSet[0].mst1.FirstPage.frmHeader.txtTitle")) = Concat(Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue, "\u000d", Form.frmHiddenStaticTexts.lblSalesOrder.rawValue)
//  xfa.resolveNode("#pageSet[0].mst1.FirstPage.frmHeader.txtTitle") = Concat(Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue, "\u000d", Form.frmHiddenStaticTexts.lblSalesOrder.rawValue, ": ",Form.frmHiddenGlobalFields.txtDocumentID.rawValue)
endif
  
//Second Page (must only be executed if there is are subsequent pages)
var pageCount = xfa.layout.pageCount();

if (pageCount > "1") then 
  if (HasValue(txtChangedDocument.rawValue) == 0)
  then
    xfa.resolveNode("#pageSet[0].mst2.SubsequentPage.frmHeader.txtTitle") = Concat(Form.frmHiddenStaticTexts.lblSalesOrder.rawValue, ": ", Form.frmHiddenGlobalFields.txtDocumentID.rawValue)
  else
    xfa.resolveNode("#pageSet[0].mst2.SubsequentPage.frmHeader.txtTitle") = Concat(Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue, "\u000d", Form.frmHiddenStaticTexts.lblSalesOrder.rawValue, ": ",Form.frmHiddenGlobalFields.txtDocumentID.rawValue)
  endif
endif

 

But always the last page will not show these values. How can I change the script in such a way that also the last page has a title and ordernumber printed in the header (master form). 

    Best answer by Pranay_M

    Hi ​@LTiel ,

    I am glad that the issue is resolved. However I would like to provide you with some additional context on the matter.

    Why the last page stays blank

    What your script is doing today:

    • It runs once in Form.frmHiddenGlobalFields.txtFormTitle::ready:layout.
    • It directly writes into:
      • #pageSet[0].mst1.FirstPage.frmHeader.txtTitle (first page)
      • #pageSet[0].mst2.SubsequentPage.frmHeader.txtTitle (second and following pages in that first pageSet)

    The usual reasons the last page ends up blank are:

    1. A different master is used on the last page (e.g. a LastPage master page), which your script never touches; or
    2. A second occurrence of the pageSet is created when the form overflows, so the last page is in pageSet[1], but you only ever update pageSet[0].

    Either way, you're updating only a specific master in a specific pageSet, not "whatever header is actually used on each rendered page".

    Rather than chasing pageSet indices, the simplest and most robust fix is:

    Put the logic on the header field itself (frmHeader.txtTitle) so it evaluates on every page instance that uses that master page.

    Recommended fix (no pageCount logic needed)

    1. Remove the "Second Page" / pageCount block from txtFormTitle::ready:layout.
      You can also remove the first‑page header assignment from there if you move everything to the header.

    2. On the header field on the master page(s) (e.g. FirstPage.frmHeader.txtTitle and SubsequentPage.frmHeader.txtTitle), add this FormCalc in the calculate event:

    Copy

    // frmHeader.txtTitle::calculate (FormCalc)

    if (HasValue(Form.frmHiddenGlobalFields.txtChangedDocument) == 0) then
    // Normal sales order
    $.rawValue = Concat(
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    else
    // Change to sales order
    $.rawValue = Concat(
    Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue,
    "\u000d",
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    endif

    Notes:

    • $.rawValue refers to this header field instance on whichever page it appears.
    • As long as your hidden fields (txtChangedDocumenttxtDocumentID, the static labels) are available in the form, every occurrence of the header on every page that uses that master will get the correct title and order number automatically.
    • If you have a separate LastPage master, just put the same frmHeader.txtTitle (with the same calculate script) on that master as well.

    If you insist on keeping the ready:layout "central script"

    If you really want to drive this from txtFormTitle::ready:layout, you must loop over all pages and set the header for the master actually used on each page, instead of hard‑coding pageSet[0]:

    Copy

    // Form.frmHiddenGlobalFields.txtFormTitle::ready:layout

    var pages = xfa.layout.pageCount()
    var i, masterName

    for i = 0 upto (pages - 1) do
    // Which master page is used on this page?
    masterName = xfa.layout.pageContent(i, "master")

    // Skip if no master (shouldn't normally happen)
    if (masterName == "") then
    continue
    endif

    // Build path to the header title on that master
    // Adjust the path segments to your actual hierarchy
    var headerPath = Concat("#pageSet[0].", masterName, ".frmHeader.txtTitle")

    if (HasValue(txtChangedDocument.rawValue) == 0) then
    xfa.resolveNode(headerPath).rawValue = Concat(
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    else
    xfa.resolveNode(headerPath).rawValue = Concat(
    Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue,
    "\u000d",
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    endif
    endfor

    But this is more fragile (you still have to get the pageSet index right), which is why I strongly recommend the calculate-on-the-header-field pattern above.

    Thanks
    Pranay

    2 replies

    LTielAuthor
    Level 2
    April 7, 2026

    Issue is resolved by another topic on this website!

    Pranay_MAdobe EmployeeAccepted solution
    Adobe Employee
    April 8, 2026

    Hi ​@LTiel ,

    I am glad that the issue is resolved. However I would like to provide you with some additional context on the matter.

    Why the last page stays blank

    What your script is doing today:

    • It runs once in Form.frmHiddenGlobalFields.txtFormTitle::ready:layout.
    • It directly writes into:
      • #pageSet[0].mst1.FirstPage.frmHeader.txtTitle (first page)
      • #pageSet[0].mst2.SubsequentPage.frmHeader.txtTitle (second and following pages in that first pageSet)

    The usual reasons the last page ends up blank are:

    1. A different master is used on the last page (e.g. a LastPage master page), which your script never touches; or
    2. A second occurrence of the pageSet is created when the form overflows, so the last page is in pageSet[1], but you only ever update pageSet[0].

    Either way, you're updating only a specific master in a specific pageSet, not "whatever header is actually used on each rendered page".

    Rather than chasing pageSet indices, the simplest and most robust fix is:

    Put the logic on the header field itself (frmHeader.txtTitle) so it evaluates on every page instance that uses that master page.

    Recommended fix (no pageCount logic needed)

    1. Remove the "Second Page" / pageCount block from txtFormTitle::ready:layout.
      You can also remove the first‑page header assignment from there if you move everything to the header.

    2. On the header field on the master page(s) (e.g. FirstPage.frmHeader.txtTitle and SubsequentPage.frmHeader.txtTitle), add this FormCalc in the calculate event:

    Copy

    // frmHeader.txtTitle::calculate (FormCalc)

    if (HasValue(Form.frmHiddenGlobalFields.txtChangedDocument) == 0) then
    // Normal sales order
    $.rawValue = Concat(
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    else
    // Change to sales order
    $.rawValue = Concat(
    Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue,
    "\u000d",
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    endif

    Notes:

    • $.rawValue refers to this header field instance on whichever page it appears.
    • As long as your hidden fields (txtChangedDocumenttxtDocumentID, the static labels) are available in the form, every occurrence of the header on every page that uses that master will get the correct title and order number automatically.
    • If you have a separate LastPage master, just put the same frmHeader.txtTitle (with the same calculate script) on that master as well.

    If you insist on keeping the ready:layout "central script"

    If you really want to drive this from txtFormTitle::ready:layout, you must loop over all pages and set the header for the master actually used on each page, instead of hard‑coding pageSet[0]:

    Copy

    // Form.frmHiddenGlobalFields.txtFormTitle::ready:layout

    var pages = xfa.layout.pageCount()
    var i, masterName

    for i = 0 upto (pages - 1) do
    // Which master page is used on this page?
    masterName = xfa.layout.pageContent(i, "master")

    // Skip if no master (shouldn't normally happen)
    if (masterName == "") then
    continue
    endif

    // Build path to the header title on that master
    // Adjust the path segments to your actual hierarchy
    var headerPath = Concat("#pageSet[0].", masterName, ".frmHeader.txtTitle")

    if (HasValue(txtChangedDocument.rawValue) == 0) then
    xfa.resolveNode(headerPath).rawValue = Concat(
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    else
    xfa.resolveNode(headerPath).rawValue = Concat(
    Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue,
    "\u000d",
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    endif
    endfor

    But this is more fragile (you still have to get the pageSet index right), which is why I strongly recommend the calculate-on-the-header-field pattern above.

    Thanks
    Pranay

    LTielAuthor
    Level 2
    April 8, 2026

    Hi ​@LTiel ,

    I am glad that the issue is resolved. However I would like to provide you with some additional context on the matter.

    Why the last page stays blank

    What your script is doing today:

    • It runs once in Form.frmHiddenGlobalFields.txtFormTitle::ready:layout.
    • It directly writes into:
      • #pageSet[0].mst1.FirstPage.frmHeader.txtTitle (first page)
      • #pageSet[0].mst2.SubsequentPage.frmHeader.txtTitle (second and following pages in that first pageSet)

    The usual reasons the last page ends up blank are:

    1. A different master is used on the last page (e.g. a LastPage master page), which your script never touches; or
    2. A second occurrence of the pageSet is created when the form overflows, so the last page is in pageSet[1], but you only ever update pageSet[0].

    Either way, you're updating only a specific master in a specific pageSet, not "whatever header is actually used on each rendered page".

    Rather than chasing pageSet indices, the simplest and most robust fix is:

    Put the logic on the header field itself (frmHeader.txtTitle) so it evaluates on every page instance that uses that master page.

    Recommended fix (no pageCount logic needed)

    1. Remove the "Second Page" / pageCount block from txtFormTitle::ready:layout.
      You can also remove the first‑page header assignment from there if you move everything to the header.

    2. On the header field on the master page(s) (e.g. FirstPage.frmHeader.txtTitle and SubsequentPage.frmHeader.txtTitle), add this FormCalc in the calculate event:

    Copy

    // frmHeader.txtTitle::calculate (FormCalc)

    if (HasValue(Form.frmHiddenGlobalFields.txtChangedDocument) == 0) then
    // Normal sales order
    $.rawValue = Concat(
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    else
    // Change to sales order
    $.rawValue = Concat(
    Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue,
    "\u000d",
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    endif

    Notes:

    • $.rawValue refers to this header field instance on whichever page it appears.
    • As long as your hidden fields (txtChangedDocumenttxtDocumentID, the static labels) are available in the form, every occurrence of the header on every page that uses that master will get the correct title and order number automatically.
    • If you have a separate LastPage master, just put the same frmHeader.txtTitle (with the same calculate script) on that master as well.

    If you insist on keeping the ready:layout "central script"

    If you really want to drive this from txtFormTitle::ready:layout, you must loop over all pages and set the header for the master actually used on each page, instead of hard‑coding pageSet[0]:

    Copy

    // Form.frmHiddenGlobalFields.txtFormTitle::ready:layout

    var pages = xfa.layout.pageCount()
    var i, masterName

    for i = 0 upto (pages - 1) do
    // Which master page is used on this page?
    masterName = xfa.layout.pageContent(i, "master")

    // Skip if no master (shouldn't normally happen)
    if (masterName == "") then
    continue
    endif

    // Build path to the header title on that master
    // Adjust the path segments to your actual hierarchy
    var headerPath = Concat("#pageSet[0].", masterName, ".frmHeader.txtTitle")

    if (HasValue(txtChangedDocument.rawValue) == 0) then
    xfa.resolveNode(headerPath).rawValue = Concat(
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    else
    xfa.resolveNode(headerPath).rawValue = Concat(
    Form.frmHiddenStaticTexts.lblChangeToSalesOrder.rawValue,
    "\u000d",
    Form.frmHiddenStaticTexts.lblSalesOrder.rawValue,
    ": ",
    Form.frmHiddenGlobalFields.txtDocumentID.rawValue
    )
    endif
    endfor

    But this is more fragile (you still have to get the pageSet index right), which is why I strongly recommend the calculate-on-the-header-field pattern above.

    Thanks
    Pranay

    Hi pranay, 

     

    Thank you so much for taking the time to help me on this. I can now understand what is happening!