Index: lams_tool_notebook/web/pages/learning/notebook.jsp =================================================================== diff -u -rb4d253a78711a9173a3966b93bfeb8252cea007e -rcf35bd28e46677a1a6d47aee32791fea96e4835b --- lams_tool_notebook/web/pages/learning/notebook.jsp (.../notebook.jsp) (revision b4d253a78711a9173a3966b93bfeb8252cea007e) +++ lams_tool_notebook/web/pages/learning/notebook.jsp (.../notebook.jsp) (revision cf35bd28e46677a1a6d47aee32791fea96e4835b) @@ -5,28 +5,50 @@ var forceResponse = "${notebookDTO.forceResponse}"; function disableFinishButton() { - document.getElementById("finishButton").disabled = true; + document.getElementById("finishButton").style.visibility = 'hidden'; } function textAreaReady() { - + + + CKEDITOR.instances["entryText"].focus(); + + document.learningForm.focusedInput.focus(); - - document.getElementById("finishButton").disabled = false; + + + document.getElementById("finishButton").style.visibility = 'visible'; } function submitForm(methodName) { disableFinishButton(); - - - if (forceResponse =="true" && document.learningForm.focusedInput.value == "") { - if (confirm("message.learner.blank.alertforceResponse")) { - return true; - } else { + + + CKEDITOR.instances["entryText"].updateElement(); // update textarea + var editorcontent = document.getElementById("entryText").value.replace(/<[^>]*>/gi, ''); // strip tags + var isEmpty = editorcontent.length === 0; + + if (forceResponse =="true" && isEmpty ) { + + retValue = confirm("message.learner.blank.alertforceResponse"); + textAreaReady(); + return retValue; + + } else if (forceResponse =="false" && isEmpty && mode == "learner") { + + if (!confirm("message.learner.blank.input")) { // otherwise, focus on the text area textAreaReady(); return false; } + } + + + if (forceResponse =="true" && document.learningForm.focusedInput.value == "") { + + retValue = confirm("message.learner.blank.alertforceResponse"); + textAreaReady(); + return retValue; } else if (forceResponse =="false" && document.learningForm.focusedInput.value == "" && mode == "learner") { @@ -36,10 +58,13 @@ return false; } } - + + + var f = document.getElementById('messageForm'); f.submit(); } + @@ -78,6 +103,13 @@ + + + + message.learner.blank.alertforceResponse + + + @@ -142,8 +174,10 @@ \ No newline at end of file