5 Replies Latest reply on Mar 9, 2007 7:24 PM by Max Katz

    SuggestionBox and Objects, rather than strings

    James Hays Novice

      Hello, I've been playing with <h:inputText and <rich:suggestionbox trying to make the suggestionbox update a bean that back the inputText box, rather than just working with Strings.

      Here is my code.

      <label>Proposal No.:
       <a4j:region id="r_proposal">
       <h:inputText id="proposal" value="#{profileRecord.proposal.projId}" />
       <rich:suggestionbox for="proposal" ignoreDupResponses="true" minChars="3"
       suggestionAction="#{newProfileRecord.autoCompleteProposals}"
       ajaxSingle="true" var="proposal" fetchValue="#{proposal.projId}"
       width="500" height="200" status="proposal_status">
       <h:column>
       <h:outputText value="#{proposal.projId}"/>
       </h:column>
       <h:column>
       <h:outputText value="#{proposal.proposalName}"/>
       </h:column>
       </rich:suggestionbox>
       </a4j:region>
      </label>
      <a4j:status id="proposal_status" for="r_proposal">
       <f:facet name="start"> <h:graphicImage width="12px" height="12px" url="/images/Spinner_Small.gif"/></f:facet>
      </a4j:status>
      


      As expected, when I type in the text field, a suggestionBox appears. When I choose a record from the suggestionBox, is there a way to update a bean on the backing SFSB of the page? Then, instead of updating the text of the textField, I can update a Bean and then reRender my textField.


      Thanks,
      James