Disabling the next button until the question is answered

MINI LESSONS ›› Actions Editor ›› Question Objects ››

MINI LESSON

DISABLING THE NEXT BUTTON UNTIL THE QUESTION IS ANSWERED

Looking for a way to keep your user on the page until after they have answered the question?


There are several ways to approach this:

Hide the next button

Ensure that anytime you enter the page, the next button is hidden and it only shows itself after the user answers the question. Read more...

Disable the next button

Ensure that anytime you enter the page, the next button is disabled and it only enables itself after the user answers the question. This solution is discussed below.

Ignore all clicks on the next button

Place a "cover object" on top of the next button so that instead of clicking the next button, the cover object gets clicked. This cover object can be any other object, such as a button, a transparent rectangle, etc. You would then ensure that the cover object is made visible when you enter the page and it is hidden when the question is answered. Read more...


Regardless of approach, only the Instructor version of ToolBook will be able to be used to implement this behavior, since programming will be involved.


BASIC NEEDS

Of the three approaches referenced above, this lesson will cover how to Disable the Next Button.


There are two fundamental tasks to handle:



DISABLING THE BUTTON WHEN THE PAGE LOADS

Trying to disable the button when the page loads is actually trickier than it may seem. The next buttons in the catalog (those within a navigation panel or standalone) have special logic applied to them which essentially says:


When the page loads



Since this logic is already built into the object, trying to override it takes a little extra effort. You might think that you can just add some On Load Page logic to disable the button, however the button's built in special logic might very well turn right around the re-enable it again.


The solution here is to give the button enough time to do what it wants, and then to apply your logic to disable the button. This is accomplished by using the Action Timer catalog object. With the Action Timer in place here's how things will work:



The Action Timer object can be found in the Action Objects category of the catalog. You'll want to add one to your individual question pages or better yet to your background (presuming your question pages share the same background) and configuring it as shown below:


   


 


Lastly you'll want to setup the logic within the Actions Editor, on the Action Timer object, to disable the next button. As seen below, On Media Complete is an event which occurs when the Action Timer has finished counting, and in our example that will be 500ms (1/2 second) after entering the page.


 


ENABLING THE BUTTON WHEN THE QUESTION IS ANSWERED

The process to enable the button is just a matter of writing the following code within the Actions Editor for the particular question object.


 



Created with the Personal Edition of HelpNDoc: Free iPhone documentation generator