pb to access to this on event onchange on the AutoCompleteTextField
-------------------------------------------------------------------

                 Key: WICKET-2005
                 URL: https://issues.apache.org/jira/browse/WICKET-2005
             Project: Wicket
          Issue Type: Bug
          Components: wicket-extensions
    Affects Versions: 1.4-RC1
         Environment: Windows XP, Firefox 3.0, IE7, safari 3.0
            Reporter: Olivier Dutrieux


I would like create a component that extends AjaxEditableLabel with replace 
TextField with AjaxEditableAutoComplete.
And I discovert a problem in the wicket-autocomplete.js when the event onchange 
is rewriting (line 83) :

83// WICKET-1280
84        objonchangeoriginal=obj.onchange; 
85        obj.onchange=function(event){
86                      if(mouseactive==1)return false;
87                      if(typeof 
objonchangeoriginal=="function")objonchangeoriginal();
88              }
89        objonchange=obj.onchange;


the problem is that the objonchangeoriginal function can't access to the this 
object, and it's necessary because I change the onchange event on 
AjaxEditableAutoComplete in case I extends AjaxEditableLabel with this :

        editor.add(new EditorAjaxBehavior()     {
                        private static final long serialVersionUID = 1L;
                        @Override
                        protected void onComponentTag(ComponentTag tag) {
                                super.onComponentTag(tag);
                                final String saveCall = "{wicketAjaxGet('" + 
getCallbackUrl() + "&save=true&'+this.name+'='+wicketEncode(this.value)); 
return true;}";
                                tag.put("onchange", saveCall);
                        }
                });


then the best way to solve the problem is to change the invocation of 
objonchangeoriginal function with that :

83// WICKET-1280
84        objonchangeoriginal=obj.onchange; 
85        obj.onchange=function(event){
86                      if(mouseactive==1)return false;
87                      if(typeof 
objonchangeoriginal=="function")objonchangeoriginal.apply(this, [event]);
88              }
89        objonchange=obj.onchange;


all invocation of function need to be change this with new invocation on the 
wicket-autocomplete.js file

Duto

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to