Updated Branches:
  refs/heads/master 91747b26f -> 2e4d229a7

WICKET-5050 precondition for active element


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/2e4d229a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/2e4d229a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/2e4d229a

Branch: refs/heads/master
Commit: 2e4d229a7a0b83e59296cbf23436ad09826aab93
Parents: 91747b2
Author: svenmeier <svenme...@apache.org>
Authored: Wed Feb 20 13:19:37 2013 +0100
Committer: svenmeier <svenme...@apache.org>
Committed: Wed Feb 20 13:19:37 2013 +0100

----------------------------------------------------------------------
 .../html/autocomplete/wicket-autocomplete.js       |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/2e4d229a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
----------------------------------------------------------------------
diff --git 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
index 7e32cfc..05846a2 100644
--- 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
+++ 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js
@@ -345,9 +345,12 @@
                        var paramName = cfg.parameterName;
                        var attrs = {
                                u: callbackUrl,
-                               dt: 'html',
+                               pre: [ function (attributes) {
+                                       return (document.activeElement == 
initialElement);
+                               }],
                                ep: {},
                                wr: false,
+                               dt: 'html',
                                sh: [ doUpdateAllChoices ]
                        };
                        attrs.ep[paramName] = '';
@@ -356,16 +359,19 @@
 
                function actualUpdateChoices() {
                        showIndicator();
+                       
                        var paramName = cfg.parameterName;
-                       var value = Wicket.$(elementId).value;
                        var attrs = {
                                u: callbackUrl,
-                               wr: false,
+                               pre: [ function (attributes) {
+                                       return (document.activeElement == 
initialElement);
+                               }],
                                ep: {},
+                               wr: false,
                                dt: 'html',
                                sh: [ doUpdateChoices ]
                        };
-                       attrs.ep[paramName] = value;
+                       attrs.ep[paramName] = Wicket.$(elementId).value;
                        Wicket.Ajax.ajax(attrs);
                }
 

Reply via email to