Expand my Community achievements bar.

Creating an interactive Index

Avatar

Former Community Member
I am creating a twenty plus page document, Each page will have an image 'pasted' in by the user, using the 'image field' option. They will also be able to add a brief description/explanation for each image in a text box.



I know how to make each description (re)appear, say on the first page by using Global binding, creating a sort of index. But what I would like to be able to do is 'Click' on a 'button/area' in the index that would allow the viewer of this document to jump to the appropriate page.



Within a PDF document it can be done (although i've never done it) but is it possible to create a 'hotlink' between a text box and the page to which it refers? with a subsequent 'back to index' button on each page?



regards



Sean
4 Replies

Avatar

Former Community Member
You can create a small field at the top of each page. Set the field up to have no borders and a background color the same as the page and no caption. Set the field up to be 1x1. Then when you want to jump to that page simply use the xfa.host.setFocus("fieldname") and you will move to the right page.

Avatar

Former Community Member
Thanks for the reply Paul,



I'm new at this game, how do I actually assign the xfa.host.setFocus to a line of text or a button?



By "Set the field up to be 1x1" I presume you mean the name under the binding tab, each page having a unique identity x2, x3 etc

Avatar

Former Community Member
Pick a page where you want to set one of these special tab fields. Drop a Text Field onto the top left corner of the page - name the object pageX_tab (where X is the page number of your page. Go to the Layout Palette (Shift -F9 if it is not visible) and set your caption to none. Now set your height and width to .1 (assuming you are working in inches). Now click on the Border Tab (shift - F8 if it is not visible). Set your background fill style to none and Borders / Edit Together to none. Now you have a field that is basically invisible and extremely small.



Now when you want to go to that page you will need an event and an object to put your code on. Text itself is not an interactive element and there are no interactive events for it. You could use a button next to your text and on the click event of that button put the code mentioned above. Now when the user clicks the button the code will execute and move to our newly created field on the appropriate page. This is the easy way. A more advanced technique would be to use a text field where you want the link to appear. Set the caption and borders like we did above, so that it has the appearance of straight text. You will have to align the Text Field with your text in your paragraph. Now you can put an initial value into this text field and I woudl set the text colour to blue and have it underlined (to indicate a link). Now in that field I would use the click event and put the same code as before.



Hope that helps

Avatar

Former Community Member
Once again, many thanks Paul



Following your instructions, I've managed to create exactly what I was after. What was throwing me initially was not having the Script Editor visible, so nowhere to type in code, sort of helps.



Now I know what I'm doing (only slightly), I can really make a mess of things, but have fun learning.



thanks again.