Reputation: 2976
I have this lines of code, where I can select a skin.
<h:form>
<h:selectOneMenu id="dropdownSkin"
value="#{helloBean.currentSkin.name}" defaultLabel="Select a skin.."
valueChangeListener="#{helloBean.skinValueChanged}">
<f:selectItems value="#{helloBean.mySkinsSI}" var="c"
itemValue="#{c.value}" immediate="true" onchange="this.form.submit()" />
</h:selectOneMenu>
<br />
<h:inputText id="name" value="#{helloBean.currentSkin.name}"></h:inputText>
<br />
<h:inputText id="tcolor" value="#{helloBean.currentSkin.tcolor}"></h:inputText>
<br />
<h:inputText id="bcolor" value="#{helloBean.currentSkin.bcolor}"></h:inputText>
</h:form>
But I debugged it and it never goes into my method:
public void skinValueChanged(ValueChangeEvent e) {
currentSkin = (Skin) e.getNewValue();
}
Any ideas why?
Upvotes: 0
Views: 201
Reputation: 392
Instead of giving on Change in f:selectItems component, try to give onchange="submit()" for h:selectOneMenu component and try. It should work.
Upvotes: 2
Reputation: 14277
There is no onchange
attribute on f:selectItems
tag. Migrate your onchange
attribute to h:selectOneMenu
and this should work.
h:selectOneMenu
is generated as HTML select
tag, and f:selectItems
are option
tags. So onchange
really should be in select
tag.
Upvotes: 2