2 Replies Latest reply on Jul 14, 2009 7:39 AM by Franco Fernandes

    Suggestionbox question

    Franco Fernandes Novice

      Hi

      How do I call a server function in the onobjectchange event ?

      What i want to do that if the user starts a new search by typing in a new value in the text box, my backing bean should set the property as null.
      I tried using the onobjectchange event, but looks it takes only Javascript and I want to call some server code and use it like this -
      onobjectchange="#{selectProductKey.setItem(null)}"



      My code if it helps understand better.

      <h:inputText id="itemCode"
       size="20"
       maxlength="30"
       label="Item code"
       autocomplete="off"
       value="#{selectProductKey.itemCode}" >
      </h:inputText>
      <rich:suggestionbox
       for="itemCode"
       var="resultItem"
       width="600"
       minChars="2"
       shadowDepth="4"
       shadowOpacity="4"
       cellpadding="2"
       ajaxSingle="true"
       suggestionAction="#{selectProductKey.suggestItem}"
       usingSuggestObjects="true"
       fetchValue="#{resultItem.itemCode}"
       nothingLabel="No items found" >
      
       <h:column> <h:outputText value="#{resultItem.itemCode}" /> </h:column>
       <h:column> <h:outputText value="#{resultItem.modelName}" /> </h:column>
       <h:column> <h:outputText value="#{resultItem.modelDescription}" /> </h:column>
      
       <a4j:support event="onselect" action="#{selectProductKey.selectItem(resultItem)}"
       reRender="itemDescription"/> <!-- reRender="itemDescription,chooseProductClassPanel" -->
      </rich:suggestionbox>
      



      Basically, I am looking for a "onunselect" action - the user backspaces or changes value in the text box. The onobjectchange is the event here I believe but I'm not sure how to call a server function.

      thanks
      Franco