display an error message when the user forget to enter text.
--- 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
--- 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
--- /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 @@
+<p class='Ldt-createAnnotation-errorMessage'>
+ You must enter text to submit an annotation
+</p>
\ No newline at end of file