[ 
https://issues.apache.org/jira/browse/WICKET-2005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Olivier Dutrieux updated WICKET-2005:
-------------------------------------

    Attachment: src.zip

I simple test that's add a AutoCompleteTextField on form. And I overwrite the 
onchange script to display (on javascripty alert) the id of 
AutoCompleteTextField. And the id is undefined. It's not normal and it's due to 
the how the the original onchange event is execute on the 
wicket-autocomplete.js.

> 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
>         Attachments: src.zip
>
>
> 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
> I will add a full example in the 1-2 hours (wait please ^^^)
> 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