-1

Suppose that selected the one value in drop down list, then after selection of value in drop down list same drop down list regenerated again in same JSP Page(as a previous drop down list).

How is to possible? How to do it?

shubhanshu
  • 97
  • 3
  • 12

4 Answers4

1

Hard way of doing it http://jsfiddle.net/daWd9/

DDK
  • 1,032
  • 18
  • 39
  • thanks a lot....but it is not working when i select any value?Please my question? – shubhanshu Sep 14 '12 at 09:19
  • use onchange event in first list and call a script which populates the duplicate list! – DDK Sep 14 '12 at 09:22
  • var opts = document.getElementById('list1'); var str = ""; var oldContent = ''; if(document.getElementById("container").innerHTML!=''){ oldContent = document.getElementById("container").innerHTML; } document.getElementById("container").innerHTML = oldContent+str; – DDK Sep 14 '12 at 11:07
  • In updated code new generated drop down box related to main drop down list.suppose i chose(select) second drop down box option then third drop down list generate not to select one drop down list? – shubhanshu Sep 14 '12 at 11:24
  • and depend upon only option .if option are three then whole program only three drop down list regenerate only? – shubhanshu Sep 14 '12 at 11:26
0

Suppose consider that your source dropdown list id is 'list1'. By using document.getElementById('list1') you'll get the details of that element. Then use document.createElement to create a new dropdown list and get the properties from the existing one document.getElementById('list1').

karthick
  • 11,998
  • 6
  • 56
  • 88
0

I suppose, you have to select multiple values from same options. I would have done it using jQuery UI. Please follow the link for demo http://jqueryui.com/demos/autocomplete/#multiple .

  1. Open the link.

  2. Start typing in textbox, options will auto-populate.

  3. You can select one and again start typing.

It will be a good user-friendly solution, in my opinion.

Hope it helps.

Saurabh
  • 1,405
  • 1
  • 21
  • 42
0

There two solutions documented in StackOverflow using AJAX technology

How to call AJAX request on dropdown change event?

How to call AJAX request on dropdown change event?

Please see the above will help you.

By the way I don't understand why you need to

regenerate again in same JSP Page(as a previous drop down list).

Community
  • 1
  • 1
Binu
  • 120
  • 6