diff ape.js @ 687:f602b19b20fd

Added mandatory pre/post test questions
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Tue, 21 Apr 2015 21:15:12 +0100
parents 820805ac7326
children 8babb8c22d59
line wrap: on
line diff
--- a/ape.js	Tue Apr 21 16:50:10 2015 +0100
+++ b/ape.js	Tue Apr 21 21:15:12 2015 +0100
@@ -583,6 +583,14 @@
 		var questionId = preTest.children[index].attributes['id'].value;
 		var questionHold = document.createElement('comment');
 		var questionResponse = document.getElementById(questionId + 'response');
+		var mandatory = preTest.children[index].attributes['mandatory'];
+		if (mandatory != undefined){
+			if (mandatory.value == 'true') {mandatory = true;}
+			else {mandatory = false;}
+		} else {mandatory = false;}
+		if (mandatory == true && questionResponse.value.length == 0) {
+			return index;
+		}
 		questionHold.id = questionId;
 		questionHold.innerHTML = questionResponse.value;
 		postPopupResponse(questionHold);