src/js/widgets/createAnnotationWidget.js
branchpopcorn-port
changeset 561 a10e7b6fdb08
parent 553 10d08f43c534
child 562 643614f78c44
--- 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