Author: channa
Date: Wed Mar 26 00:25:59 2008
New Revision: 15112

Log:

Performing user ID search on key up, to prevent keystroke lag.


Modified:
   trunk/mashup/java/modules/www/search.jsp

Modified: trunk/mashup/java/modules/www/search.jsp
==============================================================================
--- trunk/mashup/java/modules/www/search.jsp    (original)
+++ trunk/mashup/java/modules/www/search.jsp    Wed Mar 26 00:25:59 2008
@@ -487,7 +487,8 @@
 
         function getUserNames(targetField) {
             autoSuggestField = targetField;
-            var namePrefix = document.getElementById(targetField).value;
+            $(targetField + '-option').value = $(targetField).value
+            var namePrefix = $(targetField).value;
 
             if (namePrefix.length > 0) {
                 wso2.mashup.services.getUserNames(namePrefix, 
getUserNamesCallback);
@@ -511,15 +512,16 @@
 
             var node = xmlBodyContent;
             while (node != null) {
-                nameList.innerHTML += "<a href=\"javascript:assignSelected('" 
+node.lastChild.firstChild.nodeValue + "');\">" + 
node.firstChild.firstChild.nodeValue
+                var userId = node.lastChild.firstChild.nodeValue;
+                nameList.innerHTML += "<a href=\"javascript:assignSelected('" 
+ userId + "');\">" + node.firstChild.firstChild.nodeValue
                         + "</a><br/>";
                 node = node.nextSibling;
             }
         }
 
         function assignSelected(userName) {
-            document.getElementById(autoSuggestField).value = userName;
-            document.getElementById(autoSuggestField + "-option").value = 
userName;
+            $(autoSuggestField).value = userName;
+            $(autoSuggestField + "-option").value = userName;
         }
     </script>
 </head>
@@ -608,8 +610,7 @@
                     </td>
                     <td valign="top">
                         <input type="text" id="user-mashups" autocomplete="off"
-                               onkeyup="$('user-mashups-option').value = 
$('user-mashups').value"
-                               onkeyDown="getUserNames('user-mashups')"
+                               onkeyup="getUserNames('user-mashups')"          
                     
                                <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
                                <% }  else { %>value="<%=searchScope%>"<% } %>
                                 />
@@ -681,8 +682,7 @@
                     </td>
                     <td valign="top">
                         <input type="text" id="user-comments" 
autocomplete="off"
-                               onkeyup="$('user-comments-option').value = 
$('user-comments').value"
-                               onkeyDown="getUserNames('user-comments')"
+                               onkeyup="getUserNames('user-comments')"
                                <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
                                <% } else { %>value="<%=searchScope%>"<% } %>
                                 />
@@ -737,8 +737,7 @@
                     </td>
                     <td valign="top">
                         <input type="text" id="user-activity" 
autocomplete="off"
-                               onkeyup="$('user-activity-option').value = 
$('user-activity').value"
-                               onkeyDown="getUserNames('user-activity')"
+                               onkeyup="getUserNames('user-activity')"
                                <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
                                <% } else { %>value="<%=searchScope%>"<% } %>
                                 />
@@ -826,8 +825,7 @@
                     </td>
                     <td valign="top">
                         <input type="text" id="user-special" autocomplete="off"
-                               onkeyup="$('user-special-option').value = 
$('user-special').value"
-                               onkeyDown="getUserNames('user-special')"
+                               onkeyup="getUserNames('user-special')"
                                <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
                                <% } else { %>value="<%=searchScope%>"<% } %>
                                 />

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to