3 Replies Latest reply on Dec 18, 2007 4:24 PM by pmuir

    ReRender does not update the Form drop down values

    saeediqbal1

      I have the following reRender tag on the button

      <a4j:commandButton action="#{speedDial.InsertNewRecord}" value="Save" reRender="dataEntry" />


      In the stateful bean it actually modifies the value of the list but this form element inside

      <a4j:outputPanel id="dataEntry" >


      does not update the values to the new one. Here is the drop down code.

      <h:selectOneMenu id="selectedSDCode" value="#{speedDial.selectedSDCode}" >
      <s:selectItems var="sd" value="#{speedDial.speedDialCodes}" />
      </h:selectOneMenu>


      Although if i refresh the page, the drop down gets updated with correct values. The list is called speedDialCodes.

      I would rather prefer to use Ajax and not have the page refresh. Is there any solution to my issue please?

      Thanks.

        • 1. Re: ReRender does not update the Form drop down values
          damianharvey

          Many potential problems and an equal number of solutions. Post more of your code.

          Cheers,

          Damian.

          • 2. Re: ReRender does not update the Form drop down values
            saeediqbal1

            Here is the thing, the data in my code comes from my database so i dont think i can have the code out to test. But i can explain as best as possible.

            For the list that my action method populates or updates it is defined as follows: -

            @Out(required=false)
             private List <String> speedDialCodes;


            When i print it in the console it prints out good, but the "reRender" does not render that h:selectOneMenu . I noticed others had problems in this too online.

            The solution that i have now is a javascript reloading of the same page but that is no ajax anymore :( I would rather not have the page refresh and let reRender do the updating of my dropdown list but it doesn't.

            I even tried this but that didn't help much
            <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"></a4j:ajaxListener>



            If you want you could easily reproduce this code by having a simple list like this in the action method or the constructor and doing .remove() or .add() to it in the action method to see if it gets updated in the view

            speedDialCodes = new ArrayList<String>();
            
             selectedSDCode = "1";
             speedDialCodes.add("1");
             speedDialCodes.add("2");
             speedDialCodes.add("3");
             speedDialCodes.add("4");
             speedDialCodes.add("5");
             speedDialCodes.add("6");
             speedDialCodes.add("7");
             speedDialCodes.add("8");
             speedDialCodes.add("9");
             speedDialCodes.add("10");




            Any assistance would be appreciated.

            • 3. Re: ReRender does not update the Form drop down values
              pmuir

              There is a caching problem with s:selectItems in 2.0.0.GA. Try with a simple f:selectItems.