I am new to JDeveloper and ADF and I am facing a bit of a problem in getting the selected value from selectOneChoice component. This is the valuChangeListener:
public void versionValueChangeListener(ValueChangeEvent valueChangeEvent) {
System.out.println(valueChangeEvent.getOldValue().toString());
System.out.println(valueChangeEvent.getNewValue().toString());
}
This is giving the index of the selected choice and not the text itself. How can I get the text and not the index?
This is the code for the selectOneChoice:
<af:selectOneChoice value="#{bindings.Version.inputValue}"
label="#{bindings.Version.label}"
required="#{bindings.Version.hints.mandatory}"
shortDesc="#{bindings.Version.hints.tooltip}"
id="soc3" autoSubmit="true"
valueChangeListener="#{savesBean.versionValueChangeListener}">
<f:selectItems value="#{bindings.Version.items}" id="si3"/>
</af:selectOneChoice>
Thanx 🙂
This is how the guys at Orcle do it
How-to get the selected af:selectOneChoice Label although in my opinion it can be done in other way…
I think you better build a
mapin which the index will be the key and the value is the labelthan in versionValueChangeListener you’ll access the map something like this :
myMap.get(valueChangeEvent.getNewValue().toString());