2 Replies Latest reply on Sep 24, 2009 8:27 AM by nevra gül

    richfaces suggestionbox

    nevra gül Newbie

      Hello everybody,

      I m using richfaces 3.1.6 version. I hava a suggestionbox and 2 inputtexts on my page . i want to pass the selected values to these inputtexts.
      i want to set #{result.tamad} data to inputtext:sug_tamad and #{result.kulkod} data to inputtext:kulkod .
      how can i do this?

      <h:form id="suggestionbox_form">
      <h:inputText value="#{dossorBean.kulkod}" id="kulkod" class="input">
      <h:outputLabel for="kulkod" value="Kullanıcı Kodu / Adı... "/>
      </h:inputText>
      <rich:suggestionbox id="suggestionBoxId" for="kulkod"
      suggestionAction="#{dossorBean.autocomplete}" var="result"
      fetchValue="#{result.kulkod}"
      rules="none"
      first="0"
      minChars="1"
      shadowOpacity="4"
      border="1" width="300"
      height="300"
      shadowDepth="3"
      cellpadding="0"
      nothingLabel="Uygun kayıt bulunamadı.."
      columnClasses="center"
      >

      <h:column>
      <h:outputText value="#{result.kulkod}" />
      </h:column>
      <h:column>
      <h:outputText value="#{result.tamad}" />
      </h:column>
      </rich:suggestionbox>
      <rich:spacer width="10"/>
      <h:inputText id="sug_tamad" />

      </h:form>

        • 1. Re: richfaces suggestionbox
          Ilya Shaikovsky Master

          http://livedemo.exadel.com/richfaces-demo/richfaces/suggestionBox.jsf
          both samples performs analogous actions (moving selected value or other object prioperty to the other form controls)

          • 2. Re: richfaces suggestionbox
            nevra gül Newbie

            thank you for reply.
            Becuase of the richfaces version number,I can't use onobjectchange attribute.
            My version is 3.1.6. But I solved it with <a4j:support> tag. I passed the result value to my bean.
            My code like this =>

            <h:inputText value="#{dossorBean.kulkod}" id="kulkod" class="input">
            <h:outputLabel for="kulkod" value="Kullanıcı Kodu / Adı... "/>
            </h:inputText>
            <rich:suggestionbox id="suggestionBoxId" for="kulkod"
            suggestionAction="#{dossorBean.autocomplete}" var="result"
            fetchValue="#{result.kulkod}"
            rules="none"
            first="0"
            minChars="1"
            shadowOpacity="4"
            border="1" width="300"
            height="300"
            shadowDepth="3"
            cellpadding="0"
            nothingLabel="Uygun kayıt bulunamadı.."
            columnClasses="center">
            <a4j:support event="onselect" reRender="sug_tamad">
            <f:setPropertyActionListener value="#{result.tamad}" target="#{dossorBean.tamad}"/>
            </a4j:support>
            <h:column>
            <h:outputText value="#{result.kulkod}" />
            </h:column>
            <h:column>
            <h:outputText value="#{result.tamad}" />
            </h:column>
            </rich:suggestionbox>
            <rich:spacer width="10"/>
            <h:inputText id="sug_tamad" styleClass="input" value="#{dossorBean.tamad}"/>