[richfaces-svn-commits] JBoss Rich Faces SVN: r487 - trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Apr 23 11:18:10 EDT 2007


Author: F.antonov
Date: 2007-04-23 11:18:10 -0400 (Mon, 23 Apr 2007)
New Revision: 487

Modified:
   trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
Fix for bug http://jira.jboss.com/jira/browse/RF-81.

Modified: trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
--- trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js	2007-04-23 15:11:53 UTC (rev 486)
+++ trunk/richfaces/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js	2007-04-23 15:18:10 UTC (rev 487)
@@ -497,7 +497,7 @@
 
 Exadel.Suggestion = Class.create();
 Object.extend(Object.extend(Exadel.Suggestion.prototype, Suggestion.Base.prototype), {
-    initialize: function(containerId, actionUrl, element, content, options) {
+    initialize: function(containerId, actionUrl, element, content, onsubmit, options) {
         var update = options.popup || 'ac1update';
         if (!$(update)) this.create(element, update, content, options);
         this.baseInitialize(element, update, options);
@@ -508,13 +508,26 @@
         this.content = content;
         this.containerId = containerId;
         this.actionUrl = actionUrl;
+        
+        this.input = $(element);
+        this.oldValue = $(element).value;
+        if (onsubmit && onsubmit != 'null'){
+			this.onsubmitFunction = new Function(onsubmit).bind(this.input);
+		}
+        
         return this;
     },
 
     getUpdatedChoices: function(event) {
         this.options.parameters[this.options.param] = this.getToken();
-
-        A4J.AJAX.Submit(this.containerId, this.actionUrl, event, this.options);
+        
+        if (this.onsubmitFunction && ! this.onsubmitFunction()) {
+			return;
+		}
+		if (this.oldValue != this.input.value && this.input.value.length > 0) {		    
+            A4J.AJAX.Submit(this.containerId, this.actionUrl, event, this.options);
+        }
+        this.oldValue = this.input.value;
         return;
     },
 




More information about the richfaces-svn-commits mailing list