Index: lams_tool_preview/web/pages/learning/hedging.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_preview/web/pages/learning/Attic/hedging.jsp,v diff -u -r1.1.2.2 -r1.1.2.3 --- lams_tool_preview/web/pages/learning/hedging.jsp 13 Nov 2016 13:19:19 -0000 1.1.2.2 +++ lams_tool_preview/web/pages/learning/hedging.jsp 22 Nov 2016 11:16:06 -0000 1.1.2.3 @@ -26,14 +26,52 @@ function submitEntry(next){ hideButtons(); updateMark(); + if ( currentMark == ${criteriaRatings.ratingCriteria.maxRating} ) { $("#next").val(next); + + var finishedLock = '${finishedLock}'; + + if ( validateJustification() ) + + { $("#editForm").submit(); + } } else { alert('${criteriaRatings.ratingCriteria.maxRating}'); } } + + function validateJustification() { + + var justify = document.getElementById("justify"); + + //replace special characters with HTML tags + var tempTextarea = jQuery(''); + filterData(justify, tempTextarea); + var comment = tempTextarea.value; + + //word count limit + var wordLimit = ${criteriaRatings.ratingCriteria.commentsMinWordsLimit}; + if (wordLimit != 0) { + var value = $("#justify").val(); + value = value.trim(); + + var wordCount = value ? (value.replace(/['";:,.?\-!]+/g, '').match(/\S+/g) || []).length : 0; + + if(wordCount < wordLimit){ + var alertMessage = ''; + alert( alertMessage.replace("{1}", wordCount)); + return false; + } + } + + justify.value = comment; + return true; + } + + function cancel() { document.location.href=''; } @@ -89,8 +127,14 @@ - + + + ${criteriaRatings.justificationComment} + + + ${criteriaRatings.justificationComment} + +