11 Replies Latest reply on Sep 25, 2007 6:32 AM by lmk

    selectOneMenu and ajax support

    lmk

      helloo
      Im struggling with a4j support on a selectOneMenu using a4j:support ..

      I have 3 JSF/rich components,
      1- the first is a suggestion box, on the onselect event an ajax support action compute a list selectItems for the 2d component..

      2- the second component is a selectOneMenu, on the onchange event, I shoud compute a list fot the 3th component.

      The problem, is when I compute the selectItems list on the ajax support action, the a4j support on the selectOneMenu does not work..id I compute the selectitems list on the constructor not on the a4j:support action, it works..

      <a4j:region renderRegionOnly="false">
      <h:inputText value="#{queryBean.compagny}" id="textCompany" />
      <rich:suggestionbox id="suggestionCompanyId" for="textCompany"
      tokens=",[" rules="none"
      suggestionAction="#{queryBean.autocompleteCompany}"
      var="result" fetchValue="#{result.name}" rows="0" first="0"
      minChars="2" shadowOpacity="5" border="1" width="200"
      height="150" shadowDepth="0" cellpadding="5"
      style="background-color:yellow">
      <a4j:support event="onselect" reRender="client,clients"
      action="#{queryBean.findClientOf}" ajaxSingle="false">
      </a4j:support>
      <h:column>
      <h:outputText value="#{result.name}" />
      </h:column>
      <h:messages />
      </rich:suggestionbox>
      </a4j:region>
      </h:panelGroup>
      <h:outputText value="#{msg.label_client}" />
      <a4j:region renderRegionOnly="false">
      <h:selectOneMenu value="#{queryBean.client}" id="client">
      <f:selectItems value="#{queryBean.clientItems}" id="clients" />
      <a4j:support event="onchange" reRender="tx" ajaxSingle="false" />
      </h:selectOneMenu>
      <a4j:log hotkey="M" level="ALL" />
      </a4j:region>
      <h:outputText value="#{queryBean.client}" id="tx" />
      


      thanks.

        • 1. Re: selectOneMenu and ajax support
          lmk

          no idea.?

          it seems that the server variable is not saved after calling the action method..

          if i change the <f:select:items value="clienitems"/> to

          <f: selectitem value="1"/>
          <f: selectitem value="2"/>
          <f: selectitem value="3"/>


          it works..

          • 2. Re: selectOneMenu and ajax support
            ilya_shaikovsky

            at first - replace h:messages with rich:messages to get messages for ajax reuqests. And use phasetracker to check if all the JSF phases was successfully processed,

            • 3. Re: selectOneMenu and ajax support
              lmk

               

              "ilya_shaikovsky" wrote:
              at first - replace h:messages with rich:messages to get messages for ajax reuqests. And use phasetracker to check if all the JSF phases was successfully processed,


              how can i check all JSF phases?


              • 4. Re: selectOneMenu and ajax support
                ilya_shaikovsky

                1) did you tried rich:messages? I'm sure there is some conversion problem.

                2) http://www.jsftutorials.net/faces-config/phaseTracker.html

                • 5. Re: selectOneMenu and ajax support
                  lmk

                  rich:messages log a validation error.but I dont have any validation on form..

                  • 6. Re: selectOneMenu and ajax support
                    lmk

                     

                    "ilya_shaikovsky" wrote:
                    1) did you tried rich:messages? I'm sure there is some conversion problem.

                    2) http://www.jsftutorials.net/faces-config/phaseTracker.html



                    the validation error occured when I select an item computed on the a4j:support action method, the selectitem added on the JSP with the same value does not generate any error..



                    • 7. Re: selectOneMenu and ajax support
                      ilya_shaikovsky

                      this means that the type you use is wrong for this component. Read the documentation on the component.

                      • 8. Re: selectOneMenu and ajax support
                        lmk

                         

                        "ilya_shaikovsky" wrote:
                        this means that the type you use is wrong for this component. Read the documentation on the component.

                        Im not sure thats wrong type..
                        It seems that the list computed ont action method is not saved ..on the second ajaw request a lost the selectItems list..

                        I add one selectItem with the same type and the same value and I dont get any error ..




                        • 9. Re: selectOneMenu and ajax support
                          ilya_shaikovsky

                          You need to remember that there is no difference betwem just simple submit and ajax submit. If you will place h:commandButton and click it - the same will occur.. There is nothing about rich faces in such validation messages.

                          • 10. Re: selectOneMenu and ajax support
                            lmk

                             

                            "ilya_shaikovsky" wrote:
                            You need to remember that there is no difference betwem just simple submit and ajax submit. If you will place h:commandButton and click it - the same will occur.. There is nothing about rich faces in such validation messages.


                            indeed there was nothing about rich faces, its so stupid..the bean scope was request, its why I lost list values on the second ajax request.. it's work well with session scope.

                            sorry..

                            thanks a lot..


                            • 11. Re: selectOneMenu and ajax support
                              lmk

                               

                              "ilya_shaikovsky" wrote:
                              You need to remember that there is no difference betwem just simple submit and ajax submit. If you will place h:commandButton and click it - the same will occur.. There is nothing about rich faces in such validation messages.


                              indeed there was nothing about rich faces, its so stupid..the bean scope was request, its why I lost list values on the second ajax request.. it's work well with session scope.

                              sorry..

                              thanks a lot..