dcsimg
I need some help with dynamic drop-down boxes. For example, if you choose an item in the first box, the selections change in the second one?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Johan_Andersson
Posted On:   Tuesday, November 2, 2004 11:27 AM

How do I write a form with two dropdown "

Re: I need some help with dynamic drop-down boxes. For example, if you choose an item in the first box, the selections change in the second one?

Posted By:   vinayak_adkoli  
Posted On:   Tuesday, November 2, 2004 09:44 PM

one hack that i could suggest is this:

Upon making a selection on one of the drop downs, call a java Scipt using the onChange attribute. i.e.
onChange="javascript:refreshView(this.form, this);"



and in the java script have a funtion like this:


function refreshView(pFrm,pSelect)

{

pFrm.action = pFrm.action + "&" + pSelect.name + "=" + pSelect.options[pSelect.selectedIndex].value;

pFrm.submit();

}



What u've done in effect is u've fired the same action with the value of the selected option as an input parameter.
Handle this from the request and populate the contents of the second drop down into a collection or something and pass it back to the jsp....and voila, u have your second drop down in the jsp !!
About | Sitemap | Contact