2 Replies Latest reply on Jul 31, 2008 2:05 PM by Rob Stevens

    Problem using 2 suggestion box tags on same page

    Brendan Farragher Newbie

      Hi, I have two input fields with suggestion box capability on the same page. One is for entering county, the other for entering town.

      If I type into county, the suggestion box list comes up. If I type into town, the suggestion box list also comes up. When making a selection from the town list, I populate town, county, and state from the list. This all works fine.

      The problem is, the *second* time I type into county, after having made a selection from the town list, I no longer get a selection list for county any more (the suggestionAction for county is not fired. I am printing log messages to verify this). I still get back a selection list when I type into town after this initial selection has taken place.

      Do I have any tag attributes included/omitted that could be causing this problem? Is the fact that I have reRender="county" on the town's aj4:support tag an issue?

      The reason for the multiple regions is that each attribute is in a table cell. I removed the surrounding td tags to make this more readable.

      Thanks.

      JBoss AS 4.2.2
      RichFaces 3.2.1

      
      
      
      <a4j:region>
      <h:inputText id="state" maxlength="2" styleClass="ShortInput" value="#{bean.state}"/>
      </a4j:region>
      
      
      
      
      
      
      <a4j:region>
      
      <h:inputText id="county" maxlength="50" styleClass="MediumInput" value="#{bean.county}"/>
      
      <rich:suggestionbox width="200" height="200"
       id="countySuggestBox"
       for="county"
       suggestionAction="#{bean.autoCompleteCounty}" var="countyResult"
       fetchValue="#{countyResult.countyName}"
       nothingLabel="#{msgs.suggestionBoxNoMatchText}">
       <h:column>
       <h:outputText value="#{countyResult.countyName}" />
       </h:column>
       <h:column>
       <h:outputText value="#{countyResult.state}" />
       </h:column>
       <a4j:support event="onselect" reRender="state">
       <f:setPropertyActionListener value="#{countyResult}"
       target="#{bean.suggestionBoxCountyResult}" />
       </a4j:support>
      </rich:suggestionbox>
      
      </a4j:region>
      
      <a4j:region>
      
      
      
      
      
      
      <h:inputText id="town" maxlength="30" styleClass="MediumLongInput" value="#{bean.town}"/>
      
      <rich:suggestionbox width="300" height="300" id="townSuggestBox"
       for="town"
       suggestionAction="#{bean.autoCompleteTown}" var="result"
       fetchValue="#{result.town}"
       nothingLabel="#{msgs.suggestionBoxNoMatchText}">
       <h:column>
       <h:outputText value="#{result.town}" />
       </h:column>
       <h:column>
       <h:outputText value="#{result.county}" style="font-style:italic"/>
       </h:column>
       <h:column>
       <h:outputText value="#{result.state}" />
       </h:column>
       <a4j:support event="onselect" reRender="county,state">
       <f:setPropertyActionListener value="#{result}"
       target="#{bean.suggestionBoxTownResult}" />
       </a4j:support>
      </rich:suggestionbox>
      
      </a4j:region>