# HG changeset patch # User hamidouk # Date 1325514273 -3600 # Node ID a10e7b6fdb0839daf4016ed464a9ef2e6120fc24 # Parent 68e91efc5a581d3bbbfaa435549eeb2e0391b028 display an error message when the user forget to enter text. diff -r 68e91efc5a58 -r a10e7b6fdb08 src/css/LdtPlayer.css --- a/src/css/LdtPlayer.css Mon Jan 02 12:41:13 2012 +0100 +++ b/src/css/LdtPlayer.css Mon Jan 02 15:24:33 2012 +0100 @@ -675,4 +675,8 @@ font-weight: bold; color : #f7268e; text-align: center; +} + +.Ldt-createAnnotation-errorMessage { + color: #D93C71; } \ No newline at end of file diff -r 68e91efc5a58 -r a10e7b6fdb08 src/js/widgets/createAnnotationWidget.js --- a/src/js/widgets/createAnnotationWidget.js Mon Jan 02 12:41:13 2012 +0100 +++ b/src/js/widgets/createAnnotationWidget.js Mon Jan 02 15:24:33 2012 +0100 @@ -112,6 +112,23 @@ /** handle clicks on "send annotation" button */ IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) { - this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide(); - this.selector.find(".Ldt-createAnnotation-endScreen").show(); + var textfield = this.selector.find(".Ldt-createAnnotation-Description"); + var contents = textfield.val(); + + if (contents === "") { + textfield.after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template)); + textfield.css("background-color", "#d93c71"); + textfield.bind("propertychange.tmp keyup.tmp input.tmp paste.tmp", IriSP.wrap(this, function() { + var contents = textfield.val(); + console.log(contents); + if (contents !== "") { + this.selector.find(".Ldt-createAnnotation-errorMessage").hide(); + textfield.css("background-color", ""); + textfield.unbind(".tmp"); + } + })); + } else { + this.selector.find(".Ldt-createAnnotation-DoubleBorder").children().hide(); + this.selector.find(".Ldt-createAnnotation-endScreen").show(); + } }; \ No newline at end of file diff -r 68e91efc5a58 -r a10e7b6fdb08 src/templates/createAnnotation_errorMessage.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/templates/createAnnotation_errorMessage.html Mon Jan 02 15:24:33 2012 +0100 @@ -0,0 +1,3 @@ +

+ You must enter text to submit an annotation +

\ No newline at end of file