*
The moose likes HTML, CSS and JavaScript and the fly likes load data automatically when mouse over the combobox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "load data automatically when mouse over the combobox" Watch "load data automatically when mouse over the combobox" New topic
Author

load data automatically when mouse over the combobox

nad nadia
Greenhorn

Joined: Mar 20, 2007
Posts: 6
hello guys.. i am a beginner.. so i totally burr about tis.. so need yout help.. and if possible give me step by step..
the prob is..
I want to create a combo box which load its data automatically when user click the combo box. and the data is retrieve from database SQL, that means, once mouse over the combo box, it will call a function to load the data. If not, the combo box is remain empty.

thanks for any help.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You would need to use AJAX for this.
Moving to the HTML/Javascript forum where AJAX is discussed.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61227
    
  66

That really is not a good idea.

It's going to take some time for the data to get read frm the database, so waiting until the user clicks on the select element (it's not a combobox) to try to go fetch its content is a very poor idea.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
nad nadia
Greenhorn

Joined: Mar 20, 2007
Posts: 6
acctually... i just do whateva my boss need me to do...
actually our page sometimes have more than 30 drop down list in one page, so if every drop down request from database, its quite slow...
thanks for your advice, but i still need to do it,so, do know how to do it? thnaks
Tejas Tambe
Ranch Hand

Joined: Oct 08, 2001
Posts: 47
Hello Nad,

I understand your requirement and as suggested by Ben, AJAX would be the best solution. But, if you do not want to use AJAX, then why not try to sell the concept of Lookup screen?

i.e. instaead of dropdowns, provide the user with a text box. Let user enter some value, or the initial alphabet of the value he/she is looking to select. Provide a link next to your text box as 'Look up' and then based on the value entered by user, retrieve the results in a new screen. User can then select a value from the displayed ones.

This will serve 2 things,
1. user gets refined data - he/she can search
2. you do not need to populate all the drop downs
 
Consider Paul's rocket mass heater.
 
subject: load data automatically when mouse over the combobox