• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Big Time Help

 
kengyiam Ng
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I have been trying for weeks and just could not get this solve. Please kindly advise me.
I have 2 database table: (Make: Make_Id(Pri Key), Make) and (Model: Model_Id(Pri Key), Make_Id(Foreign Key), Model).
I intend to create a JSP page which will produce two combox(combox1 and combox2). Combox1 will retrieve "make" from table Make, while Combox2 will retrieve "model" from table Model and combox2 will automatically change when combox1 change.
I have used Javascript to get the effect but still could not get it done.
Can you guys please help me out and advise me in details.
Thanks alot.
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kengyiam,
If you want to skip javascript,then you will have to refresh your page on change event of combox1.
In this case you can get makid once page is refreshed onchange of combox1 and fill combox2 for this makeid.
Cheers
Praful
 
kengyiam Ng
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Let say I intend to use Javascript, how do I extract data from Make and Model table and import them to Javascript array dynamically?
 
Nehul NN
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When retrive data from database using JDBC, create Javascript array & put data into array.

function getModel(makeID){
var Name_of_Array= new Array(<%number_of_elements_from_db%> ;
// USE FOR LOOP TO GET YOUR MODEL DETAILS WHEN YOU FIND MATCH USING
//MAKEID.
// Now set model details combo box using
//document.forms[0].elements[1].select(); --> check syntax
}
<FORM>
//<Your LIST BOX WILL CALL TO function getModel(<pass_your_makeid> ;>
</FORM>

Just a suggestion...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch Nehul NN!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
Thanks!
bear
JSP Fourm Bartender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic