Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to you reference the current page number and total pages in a script?

Avatar

16-12-2008

I'm trying write a small script to make field invisible when the current page equals the total number of pages, but with no luck.



Can anyone advise how to do this?



I've tried various ways to reference my fields, this being the most basic:



if(pageNumber == totalPages) {

continuedBase.presence = "invisible";

}



// pageNumber has a run time property as "Current Page Number"

// totalPages has a run time property as "Number of Pages"

// continuedBase is a text field within the same subform as pageNumber and totalPages



Thanks for any help offered.



Russell

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

16-12-2008

Do an app.alert("The page number is: + pageNumber) before the if statement and ensure that you are getting the correct values. Also check the totalPages.

Avatar

16-12-2008

Thanks Paul,



I'm very new to this (I'm still using the demo version!!), I not sure how to implement your suggestion, could you explain?



Thank you.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

16-12-2008

If you are asking how to get the current page and total pages you acn use these commands:



current page ----- xfa.layout.page(this)

total pages ------ xfa.layout.pageCount()



so your code woudl look like this:



app.alert("The curent page is: " + xfa.layout.page(this));

app.aler("The total number of pages is: " + xfa.layout.pageCount());



if(xfa.layout.page(this) == xfa.layout.pageCount()) {

continuedBase.presence = "invisible";

}