View Single Post
Old 12-07-2012, 01:36 AM   PM User | #1
Spency
New to the CF scene

 
Join Date: Nov 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Spency is an unknown quantity at this point
Internet Explorer Navigation Button/Event manager

Evening everyone,

I'm building a browser based multiple choice based test - what I want is for the questions in the test to be randomized on load- what I also want is that, if they have not selected an answer for a question, they cannot navigate to the next question.

I can get the questions to shuffle without the navigation prevention and I can do the navigation prevention to work perfectly, but only if shuffling is disabled or if the question happens to be in same order as it is in the array. The function does work with shuffling, but only if by mere chance, the order in which the questions were shuffled is identical to the order of the questions in the array.

Code:
var CurrQNum = 0;
function ChangeQ(ChangeBy){
	if ((State[CurrQNum][0] == -1)){ShowMessage('You have not selected an answer yet!'); return;}
	if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;}
	QArray[CurrQNum].style.display = 'none';
	CurrQNum += ChangeBy;
	QArray[CurrQNum].style.display = '';
	ShowSpecialReadingForQuestion();
	SetQNumReadout();
	SetFocusToTextbox();
}
Code:
var I=new Array();
I[0]=new Array();I[0][0]=100;
I[0][1]='';
I[0][2]='0';
I[0][3]=new Array();
I[0][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1]=new Array();I[1][0]=100;
cI[0][3][1]=new Array('Worst Answer','Try again!',0,0,1);
I[1][1]='';
I[1][2]='0';
I[1][3]=new Array();
I[1][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1][3][1]=new Array('Worst Answer','Click OK, then "Next Question."',0,0,1);
Code:
<p style="text-align: Center;">
<input id="NextQButton" name="button" type="submit" value="Next Question" onclick="ChangeQ(1)">
</p>
Attached is the full exercise. The original authors of the code commented out the navigation handler... I wonder if they had issues as well.

I would really appreciate anyone's advice or help. Thank you in advance,
Spence.

Evening everyone,

Posted this originally in the wrong forum I think, but here is a copy.
I'm building a browser based multiple choice based test - what I want is for the questions in the test to be randomized on load- what I also want is that, if they have not selected an answer for a question, they cannot navigate to the next question.

I can get the questions to shuffle without the navigation prevention and I can do the navigation prevention to work perfectly, but only if shuffling is disabled or if the question happens to be in same order as it is in the array. The function does work with shuffling, but only if by mere chance, the order in which the questions were shuffled is identical to the order of the questions in the array.

Code:
var CurrQNum = 0;
function ChangeQ(ChangeBy){
	if ((State[CurrQNum][0] == -1)){ShowMessage('You have not selected an answer yet!'); return;}
	if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;}
	QArray[CurrQNum].style.display = 'none';
	CurrQNum += ChangeBy;
	QArray[CurrQNum].style.display = '';
	ShowSpecialReadingForQuestion();
	SetQNumReadout();
	SetFocusToTextbox();
}
Code:
var I=new Array();
I[0]=new Array();I[0][0]=100;
I[0][1]='';
I[0][2]='0';
I[0][3]=new Array();
I[0][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1]=new Array();I[1][0]=100;
cI[0][3][1]=new Array('Worst Answer','Try again!',0,0,1);
I[1][1]='';
I[1][2]='0';
I[1][3]=new Array();
I[1][3][0]=new Array('Best Answer','Click OK, then "Next Question."',1,100,1);
I[1][3][1]=new Array('Worst Answer','Click OK, then "Next Question."',0,0,1);
Code:
<p style="text-align: Center;">
<input id="NextQButton" name="button" type="submit" value="Next Question" onclick="ChangeQ(1)">
</p>
Attached is the full exercise. The original authors of the code commented out the navigation handler... I wonder if they had issues as well.

I would really appreciate anyone's advice or help. Thank you in advance,
Spence.
Attached Files
File Type: txt Tutorial.txt (40.5 KB, 19 views)
File Type: txt Tutorial.txt (40.5 KB, 18 views)

Last edited by VIPStephan; 12-07-2012 at 06:33 PM..
Spency is offline   Reply With Quote