Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

User input either from drop down list or input text filed

 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to craete a JSF page. I want to get the user input either from a drop down list or input text field
If the user starts typing in "input text" then the drop down list should be disabled. Otherwise if the user selects a name from the drop down list, then input text filed should be disabled. I tried as follows. But it doesn't work properly. Can anyone give me some suggestion?



 
Gopu Akraju
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should I use Ajax for this? But I haven't used it before.
So any simple solution for the above situation? Thanks.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18163
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are describing closely resembles a ComboBox control, except that a traditional ComboBox doesn't actually disable the list, since typing can be used to more rapidly locate an entry in the list. A variation of this for Web 2.0 is to use AJAX to cause the list to dynamically adjust itself based on what has already been typed.

Basic HTML does not support a ComboBox control, although a lot of OS native GUIs do. Because of that, you have to use JavaScript to glue a TextBox and a Select control together. Or, better yet, find a JSF extension tag library that does ComboBoxes for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic