I have an infopath form, and I want to create a sort of table of contents so that when users return to finish filling out their forms (after having left off), they can jump to the section.

I see that I can create a hyperlink, but I don't see any way to insert a hyperlink anchor.

Is there a way to do this? How?


If to answer "How to insert a named hyperlink anchor in InfoPath?" then you can't because Infoapth forms are not HTML webpages (from client Infopath side).

Instead of link one should use a button and formatting rules for this. If you want to appear it as a link, then remove borders, shading, changethe font color and underline.

You might find to be helpful these articles:

Answering comment-question:

You can use (probably also set hidden controls) SelectText and SelectNode in codebehind, see MSDN article:

Note this is accessing data and through it jumping to their visual representations (or rendering containers) - controls to which data fields are bound. There is no way to access controls, i.e. visual representation and rendering objects , in Infopath (client) codebehind, only their data.

It is always helpful to remember that Infopath forms are XML-based, with XML for data and forms being used externally and by various disparate (and incompatible) services in various rendering formats (in order to avoid frustrating requirements and wishes of pulling yourself up by your own hair).

This is obvious underdevelopment in Infopath since, for example, MS Offcie Words .doc (.docx) documents are enabled to have a bookmark and link a hypelink to it (to jump/navigate to other parts of ta Word document).

Another approach (and probably for using the Infopath data forms from browser only while browser-enabled forms can be also opened in client/Filler) would have been to tweak Infopath template XSL files content (by your own custom XSLT rules) though it will be a maintenance nightmare since it is not supported OOTB and this results in necessity to tweak repaet those tweakings after each editing of template in Infopath Designer or discontinue editing in Infopath Designer at all.

| improve this answer | |
  • Hi, Gennady - fancy meeting you here! I suspected that was the case with the anchors. That's not a bad idea using buttons instead of hyperlinks. It seems to me, after reading the first article, that they are describing a way to filter the data and have it display as if one were navigating through panels. However, I don't want to filter or hide anything on the form. Is there something else I can do? Isn't there a way to make the form scroll? – bgmCoder Nov 1 '12 at 14:23
  • Maybe this can be done in form code? – bgmCoder Nov 1 '12 at 14:30
  • Answered in body of my answer – Gennady Vanin Геннадий Ванин Nov 1 '12 at 16:21
  • Gennady, this is a good answer; it doesn't get me what I want, but does clarify the matter enough for me to give up! You get my +1, too. – bgmCoder Nov 5 '12 at 2:09
  • BGM, thanks! I updated my answer even before seeing yours. Anyway I commmented your answer. The point is: either one studies and use inter-related MS prodcuts (Sharepoint, Infopath, Windows Server) OOTB (without hacking) or it is less frustrating to start developing your own (open-source?) sibling/alternative to them – Gennady Vanin Геннадий Ванин Nov 5 '12 at 3:44


Don't know about hyperlink anchors...

But one way of doing this could be having multiple views, in this way on load you will show the view for Table Of Contents, and their having HyperLinks or Buttons for which you will define Rule to switch view!

Here are some articles on that:
Add, delete, and switch views (pages) in a form
Automatically switch views in a form
Create an InfoPath form that switches views

Must look at the last one, he has done beautiful vertical tabbing for the contents! :)

| improve this answer | |
  • That's not quite the answer I was hoping for, but you get my +1 for the "neat-ness" of the idea! – bgmCoder Nov 1 '12 at 0:57

Ah, I should've thought of it before! You could do this with javascript. Since the form runs in a browser, you could use javascript to change certain text into hyperlinks, and certain other text into hyperlink anchors.

However, if you look at the code in Firebug, there aren't any IDs to grab ahold of, and the classes seem to be assigned to multiple objects based on styles applied. For example, if you have text that has style1, all instances of any text with that style will have that class. This could give you a smaller range in which to cycle for the text replacement. Still, you will end up having to match the text value of the span tags.

| improve this answer | |
  • 1) This workaround is only for usage from browser. Sharepoint provides an option to open the browser-enabled forms also in client/Filler and this cannot be removed without hacking. 2)It is frustrating to look in javascript in order to access the internals of already compiled Infopath webpart. 3)Though you can construct a webpage with small Infopath weparts inserting hyperlinks for jumping outside of Infopath webparts in a webpage. 4)I also updated my answer by possibility to hack .XSL files of template source file but it is the way of starting to develop your own alternative to Sharepoint – Gennady Vanin Геннадий Ванин Nov 5 '12 at 3:34
  • Yes, I know it is a hack to use javascript that way, and I know it only works in the browser; I posted that solution because it is a way to accomplish the original goal, albeit, it isn't the best way. I concur with everything you've said, however. – bgmCoder Nov 5 '12 at 15:05

Also note that there is already a ton of javascript that will hinder you from dynamically adding things to the forms elements using jQuery/Javascript. InfoPath forms usually load after everything else since they rely on jSON data which is deeply embedded into the software. I could only "hack" into the fields after the page was loaded by having a button that would append() to a form field, however you have to be careful because textareas and other input fields to NOT like HTML and will literally not render correctly. I had to create a field that had rich text enabled and then have something (table in my situation) that you could copy and paste. I am sure there is a better way, however InfoPath is very painful to manipulate and remain cross browser complient as well. Note that if you are not in IE, the rich text field will not work AND most of the script you may try to implement may not render correctly simply because you are using IE. Good luck!

| improve this answer | |
  • Thanks for the ideas. Sometimes a hack will lead to better approaches than one had previously considered. – bgmCoder May 27 '13 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.