8 Replies Latest reply on Nov 19, 2008 4:15 AM by Ilya Shaikovsky

    richFaces suggestionbox! Send param for the backBean

    nightiger Newbie

      I have a list (I consulted in the Database) of Names of People in suggestionbox!
      When I click in a Name, want to catch the ID or the Name of this Person.
      To make this I sending one param> (<f: param/>.) for backBean == in dataTable
      The difference is that param> always comes null! It seems that the data are lost in the way!

        • 1. Re: richFaces suggestionbox! Send param for the backBean
          Ilya Shaikovsky Master

           

          <rich:suggestionbox width="200" height="200" for="test"
           suggestionAction="#{bean.autocomplete}" var="cap">
           <h:column>
           <f:facet name="header">
           <h:outputText value="Sometext"></h:outputText>
           </f:facet>
           <h:outputText value="#{cap.text}"></h:outputText>
           </h:column>
           <a4j:support event="onselect" action="#{bean.action}">
           <f:setPropertyActionListener value="#{cap.label}" target="#{bean.property1}" />
           </a4j:support>
           </rich:suggestionbox>


          Works as you need ;)

          • 2. Re: richFaces suggestionbox! Send param for the backBean
            nightiger Newbie

            But if I use this:

            <f:setPropertyActionListener value="#{bean.label}"
            target="#{bean.strString}" />

            The value is set by is null, ever !
            ----------------------------------------------------
            But if I use this:

            <f:setPropertyActionListener value="LABELL"
            target="#{bean.strString}" />

            The value is set by correctly

            • 3. Re: richFaces suggestionbox! Send param for the backBean
              Ahmet Aksoy Newbie

              I tried this example. I think "f:setPropertyActionListener" tag looks for the bean in a different scope than the request scope that h:suggestionBox tag uses.

              • 4. Re: richFaces suggestionbox! Send param for the backBean
                Jaime Martin Apprentice

                softwareaksoy, how are you assigning the id to other field?
                I was trying it this way:

                 <s:decorate id="currencyIsoDecoration" template="layout/edit.xhtml">
                 <ui:define name="label">#{messages['CfgCurrency']}</ui:define>
                 <h:inputText id="currencyIso"
                 value="#{rstReportHome.instance.cfgCurrency.currencyIso}"
                 required="true">
                 </h:inputText>
                 <rich:suggestionbox for="currencyIso"
                 suggestionAction="#{cfgCurrencySuggest.suggestCfgCurrency}"
                 var="name"
                 fetchValue="#{name.currencyIso}"
                 tokens=","
                 selfRendered="true"
                 width="500">
                 <f:facet name="nothingLabel">
                 <h:outputText value="Empty"/>
                 </f:facet>
                
                
                 <h:column>
                 <h:outputText value="#{name.currencyDes} (#{name.currencyIso})"></h:outputText>
                 </h:column>
                 <a:support event="onblur" reRender="currencyIso"/>
                 </rich:suggestionbox>
                 </s:decorate>
                


                And now with


                 <s:decorate id="currencyIsoDecoration" template="layout/edit.xhtml">
                 <ui:define name="label">#{messages['CfgCurrency']}</ui:define>
                 <h:inputText id="currencyIso"
                 value="#{rstReportHome.instance.cfgCurrency.currencyIso}"
                 required="true">
                 </h:inputText>
                 <rich:suggestionbox for="currencyIso"
                 suggestionAction="#{cfgCurrencySuggest.suggestCfgCurrency}"
                 var="name"
                 fetchValue="#{name.currencyIso}"
                 tokens=","
                 selfRendered="true"
                 width="500">
                 <f:facet name="nothingLabel">
                 <h:outputText value="Empty"/>
                 </f:facet>
                
                
                 <h:column>
                 <h:outputText value="#{name.currencyDes} (#{name.currencyIso})"></h:outputText>
                 </h:column>
                 <a:support event="onselect" action="#{rstReportHome.sugBox}">
                 <f:setPropertyActionListener value="#{name.currencyIso}" target="#{rstReportHome.instance.cfgCurrency.currencyIso}" />
                 </a:support>
                 </rich:suggestionbox>
                 </s:decorate>
                
                


                thanks in advance!

                • 5. Re: richFaces suggestionbox! Send param for the backBean
                  Ahmet Aksoy Newbie

                  I couldnt make the code work, either. I tried many alternatives and none of them havent worked. I realized that the bean doesnt exist in request scope.

                  • 6. Re: richFaces suggestionbox! Send param for the backBean
                    Jaime Martin Apprentice

                    thank you! If anyone has succeeded in using suggestionBox please let us know. I can´t believe there is NOT a way of using it to store data selected in a bean!

                    • 7. Re: richFaces suggestionbox! Send param for the backBean
                      Kathy Zhu Newbie

                      It has been more than a year. I ran into the same problem that the value from f:setPropertyActionListener is always null when the backbean setter is called.

                      • 8. Re: richFaces suggestionbox! Send param for the backBean
                        Ilya Shaikovsky Master

                        kazoo, such post tells nothing about the source of the problem. this post is too old. from those times I do not heard about non working f:setPropActListener.. So please make more input about your environment, your page..

                        And try to update from the beggining if you using some old RF versions .