Disallow testers to go back to
previous questions

Chong-ho (Alex) Yu, Ph.D., MCSE, CNE

Problem:

Sometime later questions in a test may give hints to the answers of earlier questions. One of the advantages of conducting online tests is to display one question per page. After the tester has been given the answer to a question and proceed to the next question, he cannot go back to change answers of previous items. However, in a browser there is a back button in the toolbar and a back option in the pull down menu. How can I disable both of them?

Solution:

To disable the back option, the login page must be customized. JavaScript can perform this function. In the login page use the following codes.


<script language="JavaScript">

function newpage()

{
	msg=open("","DisplayWindow","status=no,scrollbars=yes,
	resizable=0,copyhistory=0,toolbar=no,directories=no,
	menubar=no,location=right,width=500,height=400")

	msg.document.write("<head><title>Test</title>
	</head><body bgcolor=FFFFFF>");
  
	msg.document.write("<FORM ACTION=FMPro METHOD=post>");

	msg.document.write("<INPUT TYPE=hidden NAME=-DB 
	VALUE=assessment>");

	msg.document.write("<INPUT TYPE=hidden NAME=-format 
	VALUE=q1.htm>");

	msg.document.write("<INPUT TYPE=hidden NAME=-error 
	VALUE=new_error.htm>");

	msg.document.write("<center><FONT COLOR=purple>
	<h3>Log into the test</h3></FONT></center><p><hr size=4><p>");

	msg.document.write("<b>Please enter your ID.</b><p>");
	
	msg.document.write("<FONT COLOR=blue><B>User ID:</B>
	</FONT><INPUT TYPE=hidden NAME=-op VALUE=cn>
	<INPUT TYPE=password NAME=user_id SIZE=30>");

	msg.document.write("<P><HR size=4><BR>
	<INPUT TYPE=submit NAME=-New VALUE=Enter></form>");

}
</script>
         
<a href="login.html" onClick="newpage()"><b>Login the test</b></a>       
 

Caution: You must edit the above code and open the file every time in a pure text editor only. If you use HomePage or some other WYSIWYG editor, it will insert quotation marks or/and pound signs into the script and make the JavaScript non-interpretable. Also, when you copy and paste the preceding code into your HTML editor, hidden line breaks are also inserted. It will affect the function of JavaScript. After you have pasted the code into a HTML page, make each "msg.document.write" statement as a continuous line so that all hidden line breaks are deleted.

The above codes look complicated. It isn't. Let me explain them line by line.

When the link "Login the test" is clicked, a page like the following will popup.

When the tester fails to login, you should provide a way for him to get out. Do not insert a link to go back to the "login.html." When links are established among multiple windows, the display can be messed up easily. Instead, insert a close button in "new_error.htm" and let the tester starts over. The syntax to create a close button is in the following


	<FORM ACTION="" METHOD=POST>
		<INPUT TYPE=button NAME=Button VALUE="Close" onclick="window.close()">
	</FORM>

The error page should appear as shown below:

After the user login the system, the first question page ("q1.htm") would be shown in the same Window. The following code should be inserted into "q1.html" in order to lead the tester to the next question upon the completion of the first one.


	<FORM ACTION="FMPro" METHOD="POST">
		<INPUT TYPE="hidden" NAME="-DB" VALUE="assessment">
		<INPUT TYPE="hidden" NAME="-Lay" VALUE="Layout #1"> 
		<INPUT TYPE="hidden" NAME="-Format" VALUE="q2.html">
		<INPUT TYPE="hidden" NAME="-Error" VALUE="record_detail_error.htm">
		<INPUT TYPE="hidden" NAME="-recid" VALUE="[fmp-currentrecid]">

The fourth statement tells the system to go to the second question when the first one is finished. The last statement tells the system to remember the record ID so that all answers are associated with the same user. The same technique should be applied to all question pages. Again, all questions will be displayed in a Window without the back option as shown below.

This approach is not perfect, of course. An advanced user can still go back to the previous question by pressing down the apple and the left arrow keys. But, something is better than nothing!


Navigation

FMP Tips Contents

Other computer tips

Search Engine

Credit/Copyright ©

Simplified Navigation

Table of Contents

Contact Me