• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need help with dropdown box

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 dropdown boxes. The second box depends on the first one.

The first dropdown box is static and has values to select an option.

The second one is based on the first one and accesses different tables in the database based on the selection.

I am using the Struts html:select tag for the dropdown boxes.

Can somebody give me any hints to code this part?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll need javascript.

You can either:
1) Store all tables as javascript collections and dynamically swap out the values of the second menu when the first menu changes.
2) Make a call to the server when the first menu changes to have it return the proper values for the second menu.
 
meera rao
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. Can you explain me how should i proceed with the code?
 
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi meera...

as marc said there were some ways which includes ..

1. store all pertaining data in the javascript variables array
2. get data from the data base based on the data from the first the select option...

Event : onFocusOut("callMyMtd(this)") in first select box.
it will be triggered when when the user clicks and tabs oput from that select box there u have to write

Document.formname.action="kkk\ddd\ddd.do";
documnet.forname.submit();

so above code will call ur pertainig data for second option keep in sesstion or req and show in JSp page using the Tag libs.....

is above enough ...

let me know if i am missing something

 
reply
    Bookmark Topic Watch Topic
  • New Topic