4 Replies Latest reply on Dec 28, 2010 5:59 AM by dhivyast

    Dependent suggestion boxes

    dhivyast

      Hello,
      Can someone please tell me how to fix the following issue.

       

      I have two suggestion boxes , Company and Stock key . They are dependent on each other. On selecting Company , it should auto populate text field of the stock key suggestion box with the stock key, similarly if stock key is selected from the suggestion box it should auto populate the text field of company suggestion box.

      I am not able to achieve this with a4j support onselect event , rerender attribute.Moreover if the cmpnt id is given in the rerender attribute of a another cmpnt, after trying if it auto populates, it fails to work as a suggestion box.

      For example: Stock key is given as one of the cmpnts to be rerendered for company , select one value from the suggestion box for company, after this stock key fails to work as a suggestion box. it works like a ordinary text field.

      Find below my code.

       

      <

      tr>

       

      <td align="right" width="17%"><h:outputText value="Stock Key: " /></td>

       

      <td align="left" width="30"><h:inputText id="trgtStkKey" valueChangeListener="#{NewMergerBean.processValueChangeforTrgtStock}"/>

       

      <rich:suggestionbox for="trgtStkKey" minChars="3" suggestionAction="#{NewMergerBean.stkKeysuggest}" var="stockKeys">

       

      <h:column>

       

      <h:outputText value="#{stockKeys}"></h:outputText>

       

      </h:column>

       

      <a4j:support event="onselect" action="#{NewMergerBean.populateForTrgtStock} reRender="trgtCompany,trgtCountry,trgtExch,trgtGICS,trgtTicker,trgtPrice"/>

       

      </rich:suggestionbox></td>

      </tr>

      <tr>

       

      <td align="right"><h:outputText value="Target Company: " /></td>

       

      <td align="left"><h:inputText id="trgtCompany" valueChangeListener="#{NewMergerBean.processValueChangeforTrgtComp}"/>

       

      <rich:suggestionbox for="trgtCompany" minChars="3" suggestionAction="#{NewMergerBean.companySuggest}" var="companyNames"

       

      nothingLabel="Company does not exist">

       

      <h:column>

       

      <h:outputText value="#{companyNames}"></h:outputText>

       

      </h:column>

       

      <a4j:support event="onselect" action="#{NewMergerBean.populateForTrgtCompany}" reRender="trgtStkKey,trgtCountry,trgtExch,trgtGICS,trgtTicker,trgtPrice"/>

       

      </rich:suggestionbox>

      </tr>

       

       

       

       

       

       

       

      kindly let me know how to resolve this issue