• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Enable/disable SelectManyCheckbox based on radio button using Ajax

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 26547
187
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic