Index: lams_tool_preview/web/pages/learning/hedging.jsp =================================================================== diff -u -rc260f6f3f855894e54d3725095e56d39a139d893 -rb949dad84953ebb7e06117c001d10ea568f5186e --- lams_tool_preview/web/pages/learning/hedging.jsp (.../hedging.jsp) (revision c260f6f3f855894e54d3725095e56d39a139d893) +++ lams_tool_preview/web/pages/learning/hedging.jsp (.../hedging.jsp) (revision b949dad84953ebb7e06117c001d10ea568f5186e) @@ -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} + +