Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Value change listener in select one menu

 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic