• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic values in Multi Select Box when value in Combo box changes

 
Pratik Lohia
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a Multi Select box, the values in which are dependent on the values in a select box. e.g if i select a value 'x' in the combo box, the Multi select box(MSB) will have all the values having Id as 'x'. Now if I change the value in the combo box to 'y' the values in the MSB should now be the ones that have Id as 'y'. All this needs to be done using javascript on the client side.

Snippet of the MSB code... I am using Struts 1.1 tags



[edit remove all of the extra space causing major scroll issues - eric]
[ February 28, 2006: Message edited by: Eric Pascarello ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you would have to something like this:

http://www.javascriptkit.com/script/cut183.shtml

Eric
 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way to use this but the values to be populated should be dynamic and not static? i mean, is there a way to retrieve records from the database in javascript?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65218
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shuini gustav:
is there a way to retrieve records from the database in javascript?


No.
 
Bernard Sigmund Gustav
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well then isn't there a way around that?
like i could retrieve from the database using jsp place it in an array and then pass the array to javascript?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to make a request to the server to get the values. You are going to have to do it through a post back or the popular Ajax request.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic