From: Magnus Hagander Date: Sat, 14 Mar 2015 12:57:02 +0000 (+0100) Subject: Give proper error message for too long annotations X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=9d78031f1d88dc28922952f33685b518c6282241;p=pgcommitfest2.git Give proper error message for too long annotations --- diff --git a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js index be143f9..ce0df91 100644 --- a/pgcommitfest/commitfest/static/commitfest/js/commitfest.js +++ b/pgcommitfest/commitfest/static/commitfest/js/commitfest.js @@ -143,12 +143,17 @@ function addAnnotation(threadid) { updateAnnotationMessages(threadid); $('#doAnnotateMessageButton').unbind('click'); $('#doAnnotateMessageButton').click(function() { + var msg = $('#annotateMessage').val(); + if (msg.length >= 500) { + alert('Maximum length for an annotation is 500 characters.\nYou should probably post an actual message in the thread!'); + return; + } $('#doAnnotateMessageButton').addClass('disabled'); $('#annotateMessageBody').addClass('loading'); $.post('/ajax/annotateMessage/', { 't': threadid, 'msgid': $.trim($('#annotateMsgId').val()), - 'msg': $('#annotateMessage').val() + 'msg': msg }).success(function(data) { if (data != 'OK') { alert(data);