2 Replies Latest reply on Aug 26, 2010 8:54 AM by shino

    Using Two SuggestionBoxes on the same form

    heather321

      Hi,

      I'm using two SuggestionBoxes on the same page and form. Once the second SuggestionBox is used by selecting a value from its list, the first one stops working until the page is refreshed. Does anyone know how to work around this issue?

      Thanks

        • 1. Re: Using Two SuggestionBoxes on the same form
          ilya_shaikovsky

          Could not reproduce under RF 3.0.2 SNAPSHOT

          • 2. Re: Using Two SuggestionBoxes on the same form
            shino

            I know, the post is really old, but I had the same problem and maybe this will help someone:

            two inputfields (zip code and city), two suggestionboxes and each suggestionbox providing values for both inputfields (an a4j:support onselect would set the backing bean value for the other field and rerender it).

            Selecting a suggestion from the zip-code suggestionbox would kind of disable* the city suggestionbox and vice versa.

            *no request was sent to the server when typing in the inputfields.

             

            I was able to get it working agagin by changing the rerender parameter of the a4j:support onselect for the suggestioboxes: instead of only rerending the other input field (zip or city), I also included the id of the suggestionbox for the other inputfield.

             

             

            <h:inputText id="zip" value="#{address.zip}"/>
            <h:inputText id="city" value="#{address.city}"/>
            
            <rich:suggestionBox
            id="zipSuggestionBox"
            for="zip"
            fetchValue="#{suggestionItem.zip}"
            var="suggestionItem"
            suggestionActoin="#{suggestionHandler.querySuggestionsForZip}"
            minChars="#{suggestionHandler.minCharsZip}>
            <a4j:support event="onselect"  ajaxSingle="true" immediate="true" reRender="city,citySuggestionBox">
                 <f:setPropertyActionListener target="#{address.city}" value="#{suggestionItem.city}"/>
            </a4j:support>
            </rich:suggestionBox>
            
            <rich:suggestionBox
            id="citySuggestionBox"
            for="city"
            
            fetchValue="#{suggestionItem.city}"
            var="suggestionItem"
            suggestionActoin="#{suggestionHandler.querySuggestionsForCity}"
            minChars="#{suggestionHandler.minCharsCity}>
            <a4j:support event="onselect"  ajaxSingle="true" immediate="true" reRender="zip,zipSuggestionBox">
                 <f:setPropertyActionListener target="#{address.city}" value="#{suggestionItem.city}"/>
            </a4j:support>
            </rich:suggestionBox>
            

             

            Best regards

            Chris