Fix posting of comments.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 20 Oct 2010 08:27:48 +0000 (10:27 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 20 Oct 2010 08:27:48 +0000 (10:27 +0200)
src/main/resources/static/javascript/sone.js
src/main/resources/templates/include/updateStatus.html

index 7fbdab9..13d990d 100644 (file)
@@ -1,25 +1,23 @@
 /* Sone JavaScript functions. */
 
 function registerInputTextareaSwap(inputSelector, defaultText) {
-       (function(inputSelector, defaultText) {
-               $(inputSelector).focus(function() {
+       $(inputSelector).each(function() {
+               $(this).focus(function() {
                        if ($(this).hasClass("default")) {
                                $(this).removeClass("default").val("");
                        }
                }).blur(function() {
-                       alert($(this).val());
                        if ($(this).val() == "") {
-                               alert("setting default");
                                $(this).val(defaultText).addClass("default");
                        }
                }).addClass("default").val(defaultText);
-               $($(inputSelector).get(0).form).submit(function() {
-                       if ($(inputSelector).hasClass("default")) {
-                               $(inputSelector).val("");
+               var inputField = $(this);
+               $(this.form).submit(function() {
+                       if (inputField.hasClass("default")) {
+                               inputField.val("");
                        }
-                       alert(($(inputSelector).hasClass("default") ? "def: ": "ok: ") + $(inputSelector).val());
                });
-       })(inputSelector, defaultText);
+       });
 }
 
 /* hide all the “create reply” forms until a link is clicked. */
index a769503..63b4b8f 100644 (file)
@@ -3,7 +3,7 @@
                <input type="hidden" name="formPassword" value="<% formPassword|html>" />
                <input type="hidden" name="returnPage" value="<% request.uri|html>" />
                <label for="text"><%= Page.Index.Label.Text|l10n|html></label>
-               <input class="status-input" name="text" />
+               <input class="status-input" name="text" value="" />
                <button type="submit"><%= Page.Index.Button.Post|l10n|html></button>
        </form>
 </div>