]> cgit.babelmonkeys.de Git - adhocweb.git/blobdiff - js/main.js
Use readonly <input/>s for type="result" dataforms
[adhocweb.git] / js / main.js
index 4cff25caf4b3a5e62fc7acbf1ae133f656cb383e..52e6296a5c54908a740595d00a36e3712faa3c6f 100644 (file)
@@ -41,6 +41,7 @@ function onConnect(status) {
     } else if (status == Strophe.Status.CONNECTED) {
         log('Strophe is connected.');
         queryJID = connection.domain;
+        $('#queryJID').val(queryJID);
         $('#query').show();
         checkFeatures();
     }
@@ -67,6 +68,7 @@ function addForm(elem, x) {
         var type = $(this).attr("type");
         if($(this).attr("label")) {
             $("<label/>").text($(this).attr("label")).attr("for", $(this).attr("var")).appendTo(fieldset);
+            $("<br/>").appendTo(fieldset);
         }
         switch(type) {
         case "hidden":
@@ -76,7 +78,7 @@ function addForm(elem, x) {
             item = $("<input type='checkbox'/>");
             break;
         case "text-multi":
-            item = $("<textarea/>");
+            item = $("<textarea rows='10' cols='70'/>");
             break;
         case "text-single":
             item = $("<input type='text'/>");
@@ -85,7 +87,7 @@ function addForm(elem, x) {
             item = $("<input type='text'/>").attr("readonly",true);
             break;
         case "jid-multi":
-            item = $("<textarea/>");
+            item = $("<textarea rows='10' cols'70'/>");
             break;
         case "jid-single":
             item = $("<input type='text'/>");
@@ -126,12 +128,15 @@ function addForm(elem, x) {
                 item.val($(this).find("value").text());
             }
         }
+        if ($(x).attr("type") == "result")
+            item.attr("readonly", true);
         if ($(this).attr("var")) {
             item.attr("name", $(this).attr("var"));
             item.attr("id", $(this).attr("var"));
         }
         fieldset.append(item);
-        fieldset.append("<br/>");
+        if (type != "hidden")
+            fieldset.append("<br/>");
     });
     $(elem).append(form);
 }
@@ -254,7 +259,8 @@ function showConnect() {
     $('#query').hide();
     pass.show();
     jid.show();
-    $('label').show();
+    $('#cred label').show();
+    $('#cred br').show();
     $('#output').empty();
 }
 
@@ -267,6 +273,7 @@ function showDisconnect() {
     pass.hide();
     jid.hide();
     $('#cred label').hide();
+    $('#cred br').hide();
 }
 
 $(document).ready(function () {