0 Replies Latest reply on Nov 28, 2011 3:52 AM by stephan.m

    Rich:Autocomplete, input field enter and suggest on enter, odd behaviour

    stephan.m Newbie



      I have a problem. I like to have an input box with autocomplete feature for a search form. The user should be able to input, navigate and send the autocomplete input box completly with keyboard. Therefore a ENTER should send the current text to the server (if the autocomplete list is open or not does not matter). If an suggest entry is highlighted this selection should be transmitted instead.


      my box:

      <rich:autocomplete mode="ajax" minChars="2" selectFirst="false" autofill="false" autocompleteMethod="#{Search.suggest}" value="#{Search.searchString}" var="suggest" id="search_input" inputClass="search_input" layout="table" fetchValue="#{suggest.name}">


      i use jQuery keyup funktion to submit form

      <rich:jQuery selector="#searchTemplateForm" timing="domready" query="keyup(function(event) { if(event.which == 13) { submitMyForm();return false; }})" />


      but this doesn't work for all browser (e.g. firefox and safari). It works if the autocomplete box is open, but not if the box is hidden. I really tried alot of stuff.

      - Change the query to keypress: works in the opposite way, if box is closed, it works, if box open not

      - onkeypress and onlistkeypress of rich:autocomplete. onlistkeypress seems to not work for me at all, onkeypress same behaviour like jQuery

      - search tree if a entry has a highlight class, but i think this is bogus anyway.


      How could I solve my problem? I think my issue is very common.