Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Combobox Script Required  RSS feed

 
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have a situation in which I have a combo box whose values are pulled from a database. Now if I select the first value in the combobox, then it should pull the corresponding values in another combo box.

A more practical view of this would be like this, Imagine I have some questions stored in questions table and the questions will have choices stored in choices table with each choice having the corresponding question id. Now I want to display them in a jsp page in the form of a combo box like I mentioned above. How can I do this? Any help appreciated.
 
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is normally called a double combo. You can either do it the classic way of posting back the form onchange of the first dropdown list OR you can look into the nifty Ajax solution. The forum and ranch are full of examples on how to do this.

Eric
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try to find them. Thanks!
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried looking by doing a search, but no satisfactory results I could get. I'm missing out some minute details on the examples spread across over the web. Does anyone here have some links...please I'm in desperate need of it.

Thanks in advance!
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GWT supports the notion of RPC calls, which are asynchronous calls to the server. In your GWT code, you invoke the RPC call, passing in a callback class that would get invoked upon completion of the call.

So in your particular case, you would listen for a select event, at which point you invoke the RPC call. Then in the callback handler (where you would have passed back any results from say a db query, etc), you populate your second listbox. All asynchronously, no need to do any post backs or anything. GWT handles all that for you very nicely.

You can find a starting point here: http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.RemoteProcedureCalls.html

Hope this helps.

John
 
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no indication in this topic that the OP is using GWT.
 
John Mikhail
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very true...I saw the previous GWT posts by Jothi and just assumed. My apologies.
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any help guys...??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66783
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an example I found with a google search on "dependent dropdowns ajax".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!