• Post Reply Bookmark Topic Watch Topic
  • New Topic

Enable/disable SelectManyCheckbox based on radio button using Ajax  RSS feed

 
Omar Ali
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'd like to disable/enable SelectManyCheckbox and the SelectOneMenu based on my selection. I have two radio buttons to be selected whether A or B. The SelectManyCheckbox and the SelectOneMenu should be disabled at the first run. When the user selects “A” the SelectManyCheckbox and the SelectOneMenu should be enabled and if the users selects “B”, the SelectManyCheckbox and the SelectOneMenu should be disabled and the items should be empty. I tried to use <f:ajax render="certificates"/>, but it doesn't work properly.


So how to solve this from the bean and thanks
 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not recommend coding anything but the simplest expressions in EL. EL is a to debug, and it risks violating the Separation of Concerns contract of MVC.

Also, specifically, it appears that the way character literal comparisons are done varies depending on server implementations. In some, user. hrRequest == ‘B’ will be done as a straight character-to-character conversion. In others, one or both operands will be promoted to "int" values.

So I prefer the more abstract (and safer) version:



Paired, of course, with an "isRequestB()" read-only property accessor methond on the "user" bean.

Although your biggest problem seems to be that I cannot find any controls whose ID is "certificates" in your sample. Only a "hrcertificates".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!