Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== diff -u -r43b40bec10e3a21bd5b78ece6ffb2d006d382e11 -r5d2ff2494dcfe4c72f1fa20564e29d707120268c --- lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision 43b40bec10e3a21bd5b78ece6ffb2d006d382e11) +++ lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision 5d2ff2494dcfe4c72f1fa20564e29d707120268c) @@ -381,7 +381,7 @@ this.CodeMirror.save(); }); } - + //only if time limit is not expired if (!isTimelimitExpired) { if (!validateAnswers()) { @@ -418,7 +418,16 @@ if (${!hasEditRight}) { return true; } + + if (typeof CodeMirror != 'undefined') { + $('.CodeMirror').each(function(){ + this.CodeMirror.save(); + }); + } + // copy value from lams:textarea (only available in essay and mark hedging type of questions) to hidden input before submit + $("textarea[name$=__textarea]").change(); + var missingRequiredQuestions = []; var minWordsLimitNotReachedQuestions = []; var maxWordsLimitExceededQuestions = []; @@ -448,8 +457,8 @@ - - //shortanswer or numerical or essay without ckeditor + + // short answer or numerical or essay without ckeditor or code style var inputText = $("input[name=question${status.index}]")[0]; if($.trim(inputText.value).length == 0) { missingRequiredQuestions.push("${status.index}"); @@ -465,14 +474,25 @@ - //essay with ckeditor + // essay with ckeditor var ckeditorData = CKEDITOR.instances["question${status.index}"].getData(); //can't be null and empty value if((ckeditorData == null) || (ckeditorData.replace(/ | |
|\s|

|<\/p>|\xa0/g, "").length == 0)) { missingRequiredQuestions.push("${status.index}"); } - + + + // essay with code style + var textarea = $("textarea[name=question${status.index}]"), + codeMirror = textarea.siblings('.CodeMirror')[0], + text = codeMirror.CodeMirror.doc.getValue(); + + if($.trim(text).length == 0) { + missingRequiredQuestions.push("${status.index}"); + } + + //ordering - do nothing