Strongly Needed Feature for Table of Contents

There are numerous ways to prevent users from skipping content. It would also be nice to entrust employees the review the content their company expects them to know without “cheating”.

The Table of Contents has shown to be a preferable way of navigating a course as reported by employees. The 3 options of format is a nice feature. I think Trivantis understands some of the customers using Lectora are not javascript experts. I understand what variables are, but lack the knowledge on how to fine tune new ones.

I have seen others suggest this, but few responses. Here is my suggestion:

Add a feature in the Table of Contents (as if it will be used as an optional method of navigation) that it populates itself as the viewers navigate with Forward arrow. This eliminates the need for status indicators and prevents skipping ahead at the same time. The user is then permitted to go back as they need.

This one feature would be one of the most important aspects of the courses I create, and many others I suspect.

Discussion (14)

Microlearning is a great concept. However, the constraints of what companies may allow combined with the set amount of content regulation require presents challenges. At the Department of Transportation a wide range of OSHA training is required. The dynamics of management spread throughout an entire state and what leadership is willing to grant makes it a tough sell. Personally, it is the way I learn the most effectively. Anything after 20 minutes and my mind is elsewhere.

Your preference of how the current ToC operates makes sense when its being used as a ToC. The same format as a navigation tool creates an environment where some may feel they know the content and skip ahead to the last page. I have seen possible work-around to address this, I have not had success in making them work.

Do you have a way to prevent a user from opening the ToC at the start of the course and clicking the last page for the final (or any other page, thus skipping content?) Please share.

If this option were included, it does not show how far they have to go- but it does show where they have been. Perhaps pages not yet viewed could be a color of the designers choosing-but still locked until they have visited it by navigational arrows, After viewing the page it turns another color.

That would be an interesting option.

I would actually prefer, though, that the ToC show all of the page titles but allow clicking only the ones the learner has been to. That would provide the added benefit of showing the learner how far along they are and how much is left to go.

But then, we're all switching to microlearning that doesn't need ToCs anyway, right? ;-)

If you really, really need this then you can use the following hack:


  1. In the publish folder locate the file trivantis-toc.js
  2. Copy this file to a common central location so that all Lectora Developers can copy the file
  3. Using any simple text editor open the file and at about line 26 (depends on your Lectora version) you will see:

    1. this.plateId = typeof(id)=='number' ? id : -1;

  4. Insert the following two lines of code after the above line:

    1. var pageStatus = window.parent.trivPageTracking.GetRangeStatus(this.plateId);

      if (pageStatus=="notstarted") this.href = 'javascript:void(null);';

  5. Save and close the file

After each publish you will need to copy the above saved file to the current published folder.

If your publish option is to zip the file then you will need to add the above file to the zip, this will overwrite the existing file in the zip.

IMPORTANT!!! This is a hack so don't expect support, if you do have any issues at all ensure that you replace the hacked file and test again before requesting support. We cannot expect Trivantis to support hacks.


Regards, Peter


Are you aware of any supplemental book on Lectora that offers "cheats" for people that don't code. As I have gone through the forum in the past few months there are some reoccurring request or challenges. It would be nice to have a cheat book for this.

My level of javascript is very limited. Just to confirm, replacing "javascript:void(null)" with this.href="Page not available" will not affect the function?

It is doing exactly what I have been trying to achieve. The only way to advance in the course is linear- forward. The user can go back to any page already visited. The status indicator marks content read, which means a progress bar is not needed.

In theory, it should not. The "this.href=" removes the link from the text and replaces it with a null link that goes nowhere. It may even be possible to just have nothing in the quotes. I'll defer to undefinedpjackson2462undefined to confirm this, as my JS use and knowledge are still in the early growth phase.

Being the accessibility "cop" is a role I've seemed to take on, I'll add one comment and question about the "hack".

Even if a TOC is initially hidden, screen readers WILL read the TOC and the status of each page (xyz completed, abs not started, etc.). I'm still working on a solution to this, but the way the implementation for the TOC is done, it's a struggle.

The comment/question is about using "this.href="javascript:void(null)"". A screen reader will still see and announce the href text (this happens on every button if you preview in browser, by the way). I'm guessing it would be easy to replace the above text with "Page not available" or something that might be more palatable for users with screen readers.


Your hack works beautifully. It makes me realize that knowing javascript is almost mandatory to excel in Lectora. That code makes the course operate exactly how the stakeholders wanted it to. I'm not a programmer, but would it be difficult for a Trivantis coder to add this as a feature in the ToC area. I have experimented with several different types of navigation. The users prefer the ToC navigation method.

Basic forward and back arrows are used. The status indicator show what content has been viewed. Access to already viewed content is open. The user is not allowed to jump ahead without using the arrow. Thank you so much.

Are you aware of any supplemental book on Lectora that offers “cheats” for people that don’t code. As I have gone through the forum in the past few months there are some reoccurring request or challenges. It would be nice to have a cheat book for this.

I second the motion! I just lucked into a post from a couple years ago from Sergei that gave me a "lectorascript" tip I didn't know about. I would love a reference on the Lectora-specific javascript functions.

Lets write that book together...

I would love to join undefinedmnotermans5114 on building a Lectora cookbook!

If you build on the idea the undefinedsmiller7502 provided, you could build a custom TOC that appears as you go. It would be variable-heavy, but simple 0/1 variables. And no Javascript or hacking required.

After setting up your custom TOC, set every listing/button/item to Initially Hidden.

In the TOC, each listing will have an action:


Show: Target: This Object; Condition: If [targetname]: Equal To 1.

[targetname] is the variable that will correspond to each listing. When creating these variables, make sure that you check the Retain Variable Between Sessions box, so this change will be permanent.

On each page that would trigger a TOC listing, you'd add a variable:


ModifyVariable: Target: [targetname, same as TOC would be helpful]; Type: Set Equal To:; Value: 1

Repeat as necessary.

Still here, sorry for the delay. Changing the href so screen readers will make sense will change the appearance, this is due to the CSS which I was unable to find.

Another question was how easy would this be for Trivantis to implement? Answer - About 3 hours, including testing.

Book of cheats? Yep, I'll be in that, however, the above is a "Hack" and a real pain as we need to overwrite the standard Trivantis JavaScript file each time we publish.

I would like to see a change to the publisher in the order of events, it should copy all the files in the extern folder last, the extern folder stores all the files that are "Attachments". This would mean all we need to do is add the file trivantis-toc.js as an Attachment and the Publisher will copy the file for us.

I have asked for this incredibly small feature a long time ago and it appears to fall on deaf ears. How small? How long would it take? About 5 mins. work and it would affect nothing, meaning no user documentation needs to be updated.

Another issue comes up if you have to publish an EXE file. No way to implement the "hack" when you're delivering in this method - at least not without great effort.

Discussions have been disabled for this post