This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Value change listener in select one menu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Value change listener in select one menu" Watch "Value change listener in select one menu" New topic
Author

Value change listener in select one menu

Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
The scenario is:

I have a page consisting of SelectOneMenu and different text fields. Based on the values selected from the select one menu,
some of the text fields need to be made mandatory.
Using onchange = "submit()" will validate other fields also, which I do not want to do at this time.

Hence I have used code as shown below which invokes a command button(that has immediate=true so that validation will
not be performed for other fields) when values are changed . In the value changed event method , I set the rendered property
of the mandatory text field.




The problem is that the value changed listener is never getting invoked
My thinking is that using immediate=true will only skip Convertion ,Validation and update model phase and the listener should be called
as is.

Regards,
Joshua


SCJP,SCWCD, Into ATG now!
Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
I think I got the point. Did some logging and found that value change listener is called in Process Validation phase and hence while using immediate=true, it was not getting fired.

Is there a way to achieve the funtionality of showing the mandatory fields depending on the values selected from dropdown without processing validations for the other fields?

Regards,
Joshua
 
Don't get me started about those stupid light bulbs.
 
subject: Value change listener in select one menu