This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Value Change Listener

 
ramesh maredu
Ranch Hand
Posts: 210
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am very new to JSF, i started learning it now, i found it interesting,but I stuck in one problem in my jsf i have one <h:selectOneRadio/> component and another <h:selectOneMenu/>, i want to change values of each component and want to read values in managed bean.
First Component is

<h:selectOneRadio disabledClass="selectOneRadio_Disabled" onchange="submit()" enabledClass="selectOneRadio_Enabled" id="radio1"
valueChangeListener="#{pc_Ramesh.handleMenu1ValueChange}"
styleClass="selectOneRadio">
<f:selectItems value="#{pc_Ramesh.values}">
</f:selectItems>
</h:selectOneRadio>

and second is

<h:selectOneMenu id="menu1" styleClass="selectOneMenu" onchange="submit()"
valueChangeListener="#{pc_Ramesh.handleMenu1ValueChange}">
<f:selectItem itemValue="red" itemLabel="Red"/>
<f:selectItem itemValue="red1" itemLabel="Red1"/>
</h:selectOneMenu>

the only difference between them is f:selectItem and f:selectItems.

if i hard code data using f:selectItem then onchange of value data is going to valuechangelistener.

but if i use f:seletItems to populate data dynamically from managed bean on change of value, value chagne listener is not being invoked at all.

Please suggest me any solution.
 
Andres Quinones
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that you should test the onclick event on the h:selectOneRadio because I think that the onchange is never called.

Hope this helps.
 
Joe Matthew
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try removing the OnChange attribute.
 
ramesh maredu
Ranch Hand
Posts: 210
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Thanks for your replies, i modified the code according to your suggestions but problem remains same, If i use f:selectItem in selectOneRadio then it is working with on click event.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic