1 Reply Latest reply on Aug 26, 2009 5:59 PM by giunad

    s:selectItems not rendered properly - a bug?

    piotr.sobczyk
      I need to create selectOneMenu with variable number of options. When user selects one item, that item will be deleted from menu options and user can't select it again. Here is a very simple xhtml code:

      <h:form>
           <h:selectOneMenu value="#{testBean.selectedOption}">
                 <s:selectItems var="_option" value="#{testBean.options}"
                      label="#{_option}"/>
            </h:selectOneMenu>
            <h:commandButton action="#{testBean.selectOption}" value="Choose" />
            <s:button value="Refresh" />
      </h:form>

      And a bean testBean:

      ...
      private List<String> options;
      private String selectedOption;
      ...

      public void selectOption(){
          options.remove(selectedOption);
          selectedOption = null;
      }

      The problem is that after clicking "Choose" button `options' list is reduced as expected in invoke application phase, then in render response phase update list is fetched ('getOptions' method on testBean is invoked returning updated options list) but the OLD options list is still selectable! Only after next request (for example clicking "Refresh" button) the options list is actually updated in component and user can select less options.

      Everything works fine if I use f:selectItems instead. I tested it in Seam 2.0.2 GA and 2.1.2. Should I post it on JIRA?