Index: lams_central/web/comments/new.jsp =================================================================== diff -u -rb511b89c988cca308db39d308edba633c9556f81 -r7c989d5270a87d9d03fa9d95c3dc7726f67b169f --- lams_central/web/comments/new.jsp (.../new.jsp) (revision b511b89c988cca308db39d308edba633c9556f81) +++ lams_central/web/comments/new.jsp (.../new.jsp) (revision 7c989d5270a87d9d03fa9d95c3dc7726f67b169f) @@ -69,6 +69,7 @@ function clearNewForm() { $('#newFormBody').val(''); + enableButton(btnName); return false; } Index: lams_central/web/comments/reply.jsp =================================================================== diff -u -r4df9f0edfb3b0b15dd52743caf6c655a461b531c -r7c989d5270a87d9d03fa9d95c3dc7726f67b169f --- lams_central/web/comments/reply.jsp (.../reply.jsp) (revision 4df9f0edfb3b0b15dd52743caf6c655a461b531c) +++ lams_central/web/comments/reply.jsp (.../reply.jsp) (revision 7c989d5270a87d9d03fa9d95c3dc7726f67b169f) @@ -26,6 +26,14 @@ }); function replyFormSubmit() { + + var btnName = "replyCommentSubmitButton"; + if ( isDisabled(btnName) ) { + return false; + } + + disableButton(btnName); + var theForm = $(replyForm); if ( validateBodyText($('#replyFormBody').val(), <%=CommentConstants.MAX_BODY_LENGTH%>, "") ) { @@ -47,7 +55,10 @@ reloadThread(response,'','',''); }); } // end validateBodyText - return false; + else { + enableButton(btnName); + } + return false; } function cancelReply() { @@ -67,7 +78,7 @@   - + Index: lams_central/web/includes/javascript/comments.js =================================================================== diff -u -r4df9f0edfb3b0b15dd52743caf6c655a461b531c -r7c989d5270a87d9d03fa9d95c3dc7726f67b169f --- lams_central/web/includes/javascript/comments.js (.../comments.js) (revision 4df9f0edfb3b0b15dd52743caf6c655a461b531c) +++ lams_central/web/includes/javascript/comments.js (.../comments.js) (revision 7c989d5270a87d9d03fa9d95c3dc7726f67b169f) @@ -42,3 +42,17 @@ alert(errorCannotRedisplayMessage); } } + + /** Disable the submit button when pressed to stop double submission. disabled = true doesn't stop the link working it just + * greys it out. So we need to test with isDisabled() in the submit methods too! Messy. */ + function disableButton(buttonId) { + $("#"+buttonId).attr("disabled", true); + $("#"+buttonId).addClass("disabled"); + } + function isDisabled(buttonId) { + return $("#"+buttonId).attr("disabled"); + } + function enableButton(buttonId) { + $("#"+buttonId).removeAttr("disabled"); + $("#"+buttonId).removeClass("disabled"); + }