This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Combobox Script Required

 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE 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
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: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll try to find them. Thanks!
 
Joe Harry
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE 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
 
Marshal
Posts: 67366
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any help guys...??
 
Bear Bibeault
Marshal
Posts: 67366
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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".
 
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!