I need to change a setting on one or more UI components (e.g., menus) based on the user selecting a different value on another menu. I have these menu UI components in a form that does not contain an command buttons or links. Here is an example:

<form>

<h:selectOneMenu id="var1Menu" value="#{SessionBean.var1}" onchange="submit( );" valueChangeListener="#{SessionBean.var1ValueChangeListener}">
   <f:selectItems value="#{SessionBean.var1Items}" />
</h:selectOneMenu>

<h:selectOneMenu id="var2Menu" value="#{SessionBean.var2}" onchange="submit( );" valueChangeListener="#{SessionBean.var2ValueChangeListener}">
   <f:selectItems value="#{SessionBean.var2Items}" />
</h:selectOneMenu>

</form>


For instance, in the "var1ValueChangeListener" I am changing the Bean's var2 field which governs the value (selected item) of the other menu in the form. However, that menu is not changing the selected item in a consistent (and very confusing) way.

Is this even possible? It should be right? Do I need a command button or link in the form? I am not using AJAX as of yet. I am going to work on that when I get this working.

What am I doing wrong?

Thanks!

Reply via email to