File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Value Change Listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Value Change Listener" Watch "Value Change Listener" New topic
Author

Value Change Listener

ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210

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.


SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
Andres Quinones
Ranch Hand

Joined: Oct 09, 2006
Posts: 57
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

Joined: Jun 10, 2008
Posts: 66
Try removing the OnChange attribute.


Regards,<br />Joe<br /> <br />"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live."<br />--Martin Golding
ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Value Change Listener
 
Similar Threads
listbox help needed
A Problem with events
Getting One Dropdown Menu Selection to Affect the Values of a Second Dropdown Menu
Problem with loading the data after Value Change Listener on selectonemenu
JSF ValueChange problems and Default method where the form submits to