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

Reference name of page

Avatar

08-12-2008

Hi,



Does anybody know how to reference the name of a page in JavaScript? I have a form with 10 pages and want to use the same code on each page to return that page's name.



Thanks for the help?

Ralph

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

09-12-2008

Its not as simple as that. Remember that this is an XML stuctured form so it is hierarchical in nature. Here is the way that I woudl get all page names:<br /><br />// get all nodes from the root node.<br />var oNodes = form1.nodes<br />//cycle through each note<br />for (i=0;i<oNodes.length;i++){<br /> //create an object for each node that we find<br /> var childElement = oNodes.item(i);<br /> // Test to see if the node is a subform node (all Pages will be subforms)<br /> if (childElement.className == "subform"){<br /> //write the name of the subform node to the screen<br /> app.alert(childElement.name);<br /> } <br />}<br /><br />If you only want to get the name of the page that you are on you get use any object on the form, get the somExpression and parse away the bits that you do not need.