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 User input either from drop down list or input text filed 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 "User input either from drop down list or input text filed" Watch "User input either from drop down list or input text filed" New topic
Author

User input either from drop down list or input text filed

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
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

Joined: Jan 13, 2008
Posts: 242
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

Joined: Jun 25, 2001
Posts: 16019
    
  20

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
 
subject: User input either from drop down list or input text filed