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. Loreto – Computer Education Technician
LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical Therapy
[Screenshot of missing layout xfa member]:
LC version 8.2.1.4029.1.523496
Acrobat Pro 9
Java Version 6 Update 15
SQL Server 2008 Express (HotFix installed)
Views
Replies
Total Likes
Try using the command:
xfa.layout.pageCount()
This will return the number of pages in your document.
Paul
Views
Replies
Total Likes
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
Views
Replies
Total Likes
can you attach a simple sample form?
Views
Replies
Total Likes
On what event are you asking for this information?
Paul
Views
Replies
Total Likes
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. Loreto – Computer Education Technician
LOMA LINDA UNIVERSITY | School of Allied Health Professions - Department of Physical TherapyViews
Replies
Total Likes
tell me you love me
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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?
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
Views
Replies
Total Likes