You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "james yong (JIRA)" <ji...@apache.org> on 2013/01/24 03:02:11 UTC

[jira] [Commented] (WICKET-4990) Problem using AutoCompleteBehavior with AjaxFormComponentUpdatingBehavior("onchange")

    [ https://issues.apache.org/jira/browse/WICKET-4990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13561350#comment-13561350 ] 

james yong commented on WICKET-4990:
------------------------------------

Here is how I fix it:
Add the following to auto-complete.js / auto-complete.min.js,

var onchangehandlers;
....
function showAutoComplete(){var input=Wicket.$(elementId);
if(onchangehandlers==null || onchangehandlers.length==0){
  var c = (jQuery.hasData(input)&&jQuery._data(input)).events['change'];
  if (c!=null&&c.length>0){
    onchangehandlers=[];
	jQuery.each(c, function(index, value) {  onchangehandlers[index]=value.handler; });
	jQuery(input).off('change');
  }
}
....
function hideAutoComplete(){
if(onchangehandlers!=null){
jQuery.each(onchangehandlers, function(index, value) {  jQuery(Wicket.$(elementId)).on('change', onchangehandlers[index]); });
onchangehandlers = null;
}
......

                
> Problem using AutoCompleteBehavior with AjaxFormComponentUpdatingBehavior("onchange")
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4990
>                 URL: https://issues.apache.org/jira/browse/WICKET-4990
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.4.0
>            Reporter: james yong
>
> Given a text field that uses the following behaviors: 
> A.  AjaxFormComponentUpdatingBehavior("onchange"); 
> B.  AutoCompleteBehavior
> Say I enter an letter 'U' into the text field, and an auto-suggest list pops up.
> When I select an item (e.g. USD) from the auto-suggest list using a mouse, the onchange event from behavior A  is fired twice. The 1st onchange event is for 'U' and the 2nd onchange event is for 'USD'. 
> This issue is mentioned as a regression by Sven Meier and related to WICKET-1280.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira