• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in populating data in comboBox  RSS feed

 
munish wadhwa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am working with an application where i want to fill a comboBox by selecting a value in other combobox from dataBase using netBeans. m not able to done with it.
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

NetBeans has nothing to do with it; the procedure would be exactly the same without an IDE. Have you see the Java™ Tutorials section about combo boxes?
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This will require Ajax. You bind a listener to the first combo box. When it fires, you use that value to run an Ajax query that returns the data needed to create the second combo box.

Show us what you have so far.
 
munish wadhwa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J. Kevin Robbins wrote:This will require Ajax. You bind a listener to the first combo box. When it fires, you use that value to run an Ajax query that returns the data needed to create the second combo box.

Show us what you have so far.



Any example you can provide to me regarding this... or Guide me how to embed AJAX with java as i didnt work on it earlier.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
munish wadhwa wrote:
Any example you can provide to me regarding this... or Guide me how to embed AJAX with java as i didnt work on it earlier.

Then you have some homework to do. First step, download and familiarize yourself with jQuery. It will make life a lot easier.

And let me correct myself; it's not a combo box. That's a term from Visual Basic (I think). It's a Select/Option control (or element).

Start simple. Create an HTML file with a select control and use jQuery to bind it to a function like so:

The jQuery code needs to go in the ready function. Read up on jQuery to understand how this works.

Post your code. If you have trouble with it, post the broken code and we'll help. When you get this much working, we'll move on to replacing that console message with an Ajax call. The next step will be to create a second select control with the results of that Ajax call.

Baby steps. Take the big problem and break it down into little, manageable problems.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What type of combo box are we actually talking about? An HTML select element, a Swing JComboBox, or something else?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!