I m very new to JSP and java script.
I have a 2 dropdown list. In both drop down i m fetching some data from data base.
In SECOND DROPDOWN LIST I have to fetch data depending on the selected item of the SECOND DropDOwn list. I have succeeded in that.
But when I select an item in first dropdown list, i m posting fors data to jsp code,and proper resuld are reflecting back. But on every ONCHANGE event on my first dropdown list page is getting reloaded and the FIRST DROPDOWN list data is get emptied. I mean it should contain what I have selected after posting parameter to jsp.
How can I stop from this or how can i retain value in the dropdown list. Is should get set back to default....
Exactly. "Cascading dropdowns" has become almost a poster child for Ajax.
If the idea of Ajax scares you, then adopting a library such as jQuery makes it a single line of script. If this direction intrigues you, I can point you to free downloadable examples from my jQuery book.
Himanshu, the link you gave is I m familior with already. My problem is that I am not senting parameter to a diff page. I m posting dropdown's parameter on the same page. and on eveny ONCHANGE event on the first dropdown list proper result are reflectiung back on second parameter but the value of second drop down is set set back to default selected calue.. Is should be what I selected before.
Can any once plese send the code to populate the value in drodown list after submitting form.
subject: How to retain selected content after post on same page