Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Reference name of page

Avatar

Former Community Member
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
1 Reply

Avatar

Former Community Member
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.