-1

I have this JSF page:

<h:selectOneRadio id="regions">
   <f:selectItem id="eu" value="EU"/>
   <f:selectItem id="us" value="US"/>
</h:selectOneRadio>

<h:selectOneListbox>
    <f:selectItems value="#{dataFetcherBean.regions}" itemLabel="..."/>
</h:selectOneListbox>

dataFetcherBean.regions is a HashMap<String, List<String>> collection. What I want, is to show different data in ListBox depending on what radio button is selected.

Is there a way to get the currently selected value in regions radio buttons to itemLabel in the ListBox?

isklenar
  • 974
  • 2
  • 14
  • 34

1 Answers1

1

You have 2 solutions :

1 - Use a listener to update your <h:selectOneListbox> after the event onchange of your <h:selectOneRadio>is triggered.

2 - Use <f:ajax> if you don't want to reload the full page.

See both here : SelectOneMenu updates other SelectOneMenu

Community
  • 1
  • 1
Thrax
  • 1,926
  • 1
  • 17
  • 32