Expand my Community achievements bar.

Missing Member: xfa.[layout]

Avatar

Level 2

Hello People:

I'm having major trouble finding (xfa.layout) object.  I get no value returned for pageCount(); It doesn't appear at all.

The only location I founded was under xfa.form.form1.layout, but pageCount() is not a member.

Here's what I'm trying to do. I need to make this function more generic.

function hidePages()

{

console.println(xfa.host.numPages);            <--prints OK.

var num = parseInt(xfa.host.numPages);  <-- Does not work.

//var num = 39;                                          <-- Works ok, hiddes all pages

console.println(num);                                  <-- prints OK

var i;

for (i = 1; i<=num; i++)

{

    console.println("Page"+i + " of  "+ num);  <--Shows sequence ok.

       xfa.resolveNode("Page"+i).presence = "hidden";

}

The code works great only if I hard code the number of pages, else the pages remain visible. What gives?

I'm looking for alternatives, like pageCount()...or is there some cleanup script I'm missing?

Any responses and comments are welcomed.

Ivan A. LoretoComputer Education Technician

LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical Therapy

[Screenshot of missing layout xfa member]:

Screenshot.JPG

LC version 8.2.1.4029.1.523496

Acrobat Pro 9

Java Version 6 Update 15

SQL Server 2008 Express (HotFix installed)

9 Replies

Avatar

Former Community Member

Try using the command:

xfa.layout.pageCount()

This will return the number of pages in your document.

Paul

Avatar

Level 2

Paul:

Thanks for your prompt response.

Console.println returns: -1

The expected value is 39.

Any other ideas?

Ivan A. Loreto – Computer Education Technician

LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical Therapy

Avatar

Former Community Member

On what event are you asking for this information?

Paul

Avatar

Level 2

Thanks for your help, folks. 

I'm implementing additional security measuer into our forms.

I'm so close to finishing, I can taste it, but [xfa.layout] is nowhere to be found.

This funciton will be triggered at form's initialize event.

Attached is a sample. I have commented out the line that works and left the call to xfa.layout.pageCount() where I get an invalid count.

Thanks again for your help..

Ivan A. LoretoComputer Education Technician

LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical Therapy

Avatar

Level 2

xrum:

Unfortunatelly, your attached sample does not resolve my issue.

I'm not trying to display the page count, but get reference to the object variable so I can use it in code.

var num = xfa.host.pageCount(); I get -1 as my value.

Thanks for your response.

iL

Avatar

Former Community Member

ok,s o you are getting -1 on form initialize becuase the pages have not yet been initialized.

how many pages are you trying to hide?

if you put

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

var num = Page1.PageCount.rawValue

in the initialize event of the "PageCount" object i've put on the form for you, it should give you the count.

i think i'm just confused what pages you are trying to hide.......all of them? just the last few?

Avatar

Level 2

xrum:

Thanks for explaining the -1 value of pageCount();

I need to hide all of the pages, regardless of how many, whenever an evaluation yields false at form's initialize event. The user will see the single MasterPage1 whenever all the other forms are hidden.

I've tried this as well to no avail:

for(var i = 1; i<= xfa.host.numPages; i++)

{

xfa.resolveNode("Page"+i).presence = "hidden";

}

Ivan A. Loreto – Computer Education Technician

LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical Therapy