by Jonathan Shoaf
Replacing the next button last page of each chapter
Setting it this way will result in the last page in each chapter going to the first page in the next chapter. That's not really the functionality I'm looking for. I want the learner to return to the main menu after each chapter so I can give them some nice updates on their course progress and allow them to choose where to go next.
Ok, simple enough, so I don't inherit the next button and add a custom button to the last page of each chapter. That button will have an action of "Go To" with a target of "Chapter, Section, or Page" that goes back to the main men page. Done, right?
That will work, but I now have multiple buttons across my project that will need updating. Depending on how many chapters you have, this could be a lot of work. I've also been known to put crazy logic at the title level that disables the next button to the learner (I'm weird that way). If the logic needs to remain but the button is no longer there to be acted on...Lectora gives me an error message. Just trust me, yuck! So scratch this method, there's a better way.
Creating a smart next button.
The better way is a "smart" next button. The smart next button knows when it is in the last page of the chapter and will automatically go back to the main menu. I do this by using a condition as follows:
- Select the Next button and make sure the action on the On Click tab is set to "None". We'll need an action which contains an Else tab.
- Add an action to the button (it has an Else tab...you'll see why its needed below)
- Set the action to occur on "Mouse Click"
- Set the action to "Go To"
- Set the target to "Next Page"
- Next, select the Condition tab and check "Perform action ONLY if the following is TRUE:"
- For the variable use "PageInChapter"
- For the relationship use "Less Than"
- For the value type in "VAR(PagesInChapter)"
- Finally, select the Else tab and check "If the conditions are not met, perform the following action:"
- Set the action to Go To
- Set the target to Chapter, Section, or Page
- Set the name to your main menu page
- Hit the Apply button (with joyful expectation that it'll all work)
It's alive! You have created a smart button. The button will now go to the next page when clicked. When you are on the last page in the chapter, it will return to the main menu. It does this by comparing PageInChapter to PagesInChapter and acting accordingly.