I have a top level selection box and a second level selection box. The values of the second level selection depend on top level selection. I am using Seam 2.0.0 beta 1 and ajax4jsf 1.1.1. I add an onChange event to the top level selection box to re-render the second level selection box. My problem is that when I change the value of the top selection, my second level values always correspond to the top level before the change. I did a debug, it seems the re-rendering happens before the model gets updated. Why is that? Here is the code:
<s:decorate id="topCategoryDecoration" template="WEB-INF/layout/edit.xhtml"> <ui:define name="label">Category</ui:define> <h:selectOneMenu id="topCategory" value="#{bc.topCategory}"> <s:selectItems id="topCategorySelectItems" value="#{topBusinessCategories}" var="cat" label="#{cat.topLevel}" noSelectionLabel="Please Select ..." hideNoSelectionLabel="true" /> <s:convertEntity/> <a:support event="onchange" reRender="subCategoryDecoration"/> </h:selectOneMenu> </s:decorate> <s:decorate id="subCategoryDecoration" template="WEB-INF/layout/edit.xhtml"> <h:selectOneMenu id="subCategory" value="#{bc.category}" rendered="#{bc.topCategory != null}"> <s:selectItems id="subCategorySelectItems" value="#{bc.subCategories}" var="subCat" label="#{subCat.secondLevel}"/> <s:convertEntity/> </h:selectOneMenu> </s:decorate>