5 Replies Latest reply on Feb 5, 2009 7:07 AM by l.fugaro

    rich:suggestionBox forcing select

    l.fugaro

      Hi to all, this is my second post, just to remind I'm new to forum and richfaces! :D

      Anyway, here is my problem:
      I've one suggestionBox, named SB1, that works fine, but I would like it to behave like this: populate the associated inputText and backingBean (called myModel) if and only if the user selects an item on the list, otherwise I want my inputText and backingBean property cleared.

      How this can be done?

      Here is my current code:

      <h:inputText id="inputText2" style="width: 300px;" />
      <h:panelGrid columns="3">
       <h:inputText id="inputText1" style="width: 300px;" />
       <rich:suggestionbox for="inputText1" suggestionAction="#{myService.getListCodePV}" var="pv" nothingLabel="Empty" minChars="1">
       <h:column>
       <h:outputText value="${pv.codePV}"/>
       </h:column>
       <a4j:support event="onselect" onsubmit="#{rich:element('inputText2')}.value='';">
       <f:setPropertyActionListener value="#{pv.id}" target="#{myModel.idPV}" />
       </a4j:support>
       </rich:suggestionbox>
      </h:panelGrid>


      Thanks in advance,
      kindly,
      Luigi