title: AjaxFormComponentUpdatingBehavior onkeypress
body: <p>I have a list of items, above which there is an input fields.<br/>
  The input field is a filter, it should filter the list based on the text you key in to the input field.</p>
  
  <p>For example :
  If you type "th", it should filter the list so that all the items should start with "th".</p>
  
  <p>For this I am using AjaxFormComponentUpadingBehavior("onkeypress").<br/>
  But this does not seem to be working they way it should.<br/>
  When I key in something it clears up that and takes the cursor to the first letter of the input field.</p>
  
  <p>I have tried onkeyup and onkeydown, and all of them act the same way.<br/>
  For now I am doing the filter on a link click which works, but I want it to be as seamless as onkeypress.</p>
  
  <p>Is there a way to achieve this?
  I am using wicket 1.4.x</p>
  
  <p>Here is the code :</p>
  
  <pre><code>        // Customer Filter input field
          customerFilterTxt = new TextField&lt;String&gt;("customerFilterTxt", new PropertyModel&lt;String&gt;(this, "slectedCustomerFilterStr"));
          customerFilterTxt.setOutputMarkupPlaceholderTag(true);
          customerListViewContainer.add(customerFilterTxt);
  
          // Ajax behavior for customer group filter auto complete input filed
          AjaxFormComponentUpdatingBehavior customerGroupFilterBehave = new AjaxFormComponentUpdatingBehavior("onkeypress") {
              private static final long serialVersionUID = 1L;
  
              @Override
              protected void onUpdate(AjaxRequestTarget target) {
                  List&lt;CustomerGroupBean&gt; filterList = new ArrayList&lt;CustomerGroupBean&gt;();
                  if(Util.hasValue(selectedCustomerGroupFilterStr)) {
                      String str = selectedCustomerGroupFilterStr.toUpperCase();
  
                      for(CustomerGroupBean group : custGroupList) {
                          if(group.getRightGroupName().toUpperCase().contains(str)) {
                              filterList.add(group);
                          }
                      }
  
                      custGroupListView.setList(filterList);
  
                  } else {
                      custGroupListView.setList(custGroupList);
                  }
  
                  target.addComponent(customerFilterTxt);
                  target.addComponent(custGroupListViewContainer);
              }
          };
          customerGroupFilterTxt.add(customerGroupFilterBehave);
  </code></pre>