2 Replies Latest reply on Apr 9, 2010 8:47 PM by Cássio Nandi Citadin

    Rich  + jQuery:autocomplete

    Cássio Nandi Citadin Newbie

      Hi there!

       

      I have this situation.

       

              <a4j:loadStyle src="/resources/css/richfaces.css" />
              <a4j:loadScript src="resource://jquery.js"/>
              <a4j:loadStyle src="/resources/css/jquery.autocomplete.css" />
              <a4j:loadScript src="/resources/javascript/jquery.bgiframe.min.js" />
              <a4j:loadScript src="/resources/javascript/jquery.autocomplete.js" />
             
              <a4j:outputPanel id="script_panel">
                  <script>
                      jQuery(function(){
                          var    data = "key word to auto ";
                          data = data.split(" ");
                          jQuery("#input_test").autocomplete(data, {multiple:true, multipleseparator:","});
                       });
                  </script>
              </a4j:outputPanel>
             
              <h:inputText id="input_test"></h:inputText>       
             
              <a4j:form>
                  <a4j:commandButton
                      value="Click"
                      reRender="script_panel"/>
              </a4j:form>

       

      When you select a suggested word and press tab, the word will be setted on the input.

      By Clicking on Click button and doing the same action (selecting e pressing tab...),  the selected word will me setted repeated, like  "word, word"

      The word is repeat equal the times the button has been clicked.

       

      Maybe there some way to clean the events attached to the #input_test or something like that...

       

       

      Well, thanks for the intereset!

       

      Using Firefox 3.5.8 and the jQuery version from richfaces 3.3.3