Index: lams_tool_lamc/web/authoring/editQuestionBox.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/authoring/editQuestionBox.jsp,v diff -u -r1.8 -r1.9 --- lams_tool_lamc/web/authoring/editQuestionBox.jsp 11 Nov 2006 19:01:55 -0000 1.8 +++ lams_tool_lamc/web/authoring/editQuestionBox.jsp 13 Nov 2006 00:31:22 -0000 1.9 @@ -72,7 +72,7 @@ function validateDuplicateCorrectAnswers() { var correctCount = 0; - for(i = 1; i < 51; i++) + for(i = 0; i < 51; i++) { var currentId="select".concat(i) var currentField=document.getElementById(currentId); @@ -97,7 +97,87 @@ } return true; } - + + + function validateSingleCorrectAnswer() + { + var singleCorrectEntry = 0; + var radioCorrect=document.McAuthoringForm.correct; + + if ((radioCorrect == 'null') || (radioCorrect == 'undefined')) + { + var msg = ""; + alert(msg); + return false; + } + + var radioGroupSize=radioCorrect.length; + + if ((radioGroupSize == 'undefined') || (radioGroupSize < 2)) + { + var msg = ""; + alert(msg); + return false; + } + + + for(i = 0; i < 51; i++) + { + if (radioCorrect[i] != null) + { + if ((typeof(radioCorrect[i]) != 'undefined') && (typeof(radioCorrect[i]) != null)) + { + if (radioCorrect[i].checked) + { + singleCorrectEntry =1; + } + } + } + } + + if (singleCorrectEntry == 0) + { + var msg = ""; + var msgSetFirst = ""; + + alert(msg); + + if ((radioCorrect[0] != 'undefined') && (radioCorrect[0] != null)) + { + radioCorrect[0].checked=true; + alert(msgSetFirst); + } + + return false; + } + return true; + } + + + function validateMinumumCandidateCount() + { + var radioCorrect=document.McAuthoringForm.correct; + + if ((radioCorrect == 'undefined') || (radioCorrect == null)) + { + var msg = ""; + alert(msg); + return false; + } + + + var radioGroupSize=radioCorrect.length; + + if ((radioGroupSize == 'undefined') || (radioGroupSize <= 2)) + { + var msg = ""; + alert(msg); + return false; + } + + return true; + } + @@ -161,7 +241,7 @@
-