How to get Subvalues using Combo box ?

Hi , friends,

I have one Combo box :

Having list of all Districts

When i select one of District it will give all related villages

regarding District that i selected in another combo box.

How to achieve this ? in one page itself

I have another idea but its not good..

where

1) first select District from Combo

2) Press submit

3) second page displays another combo and fetch perticular villages

and display in another combo.

but this technique requires more page navigation.

I want it should be on one page itself

PLEASE HELP ME ....

Ghanshyam

Message was edited by:

Ghanshyam

[701 byte] By [Ghanshyama] at [2007-11-27 5:14:11]
# 1

the brand old dependent combo issue..

as far as i know i could tell you for every two days a similar post is being posted here on the same thread..

you could have taken a look of them....

Anyways there are many ways of doing it....

In the days when XmlHttpRequest Object was not invented ppl used to achieve this using Hidden iframe and then updating parent frame dropdown by calling a javascript function onload of the page. or by auto refershing the page after saving the form state inside the scope of session.

However,using XmlHttpRequest Object (AJAX) nowdays is one of the smater ways of acheving tasks as these.

checkout one such examples where i've posted a similar example in the last reply

http://forum.java.sun.com/thread.jspa?threadID=5170019

hope this might help :)

REGARDS,

RaHuL

RahulSharnaa at 2007-7-12 10:36:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Try this,,,,

Even I am new but all I can reccomend is that try onchange="function()" function in u r select tag.Write a relevent javascript function() in which

var selectedValue = document.form.select.options[document.form.select.selectedIndex].value;

Do validations based on this value.

If u want to do the validation in JSP,then in u r function,write

document.form.hiddenTextBoxselc.value=selectedValue11;

and then in JSP,

String str=request.getParameter("hiddenTextBoxselc");

to retreive the value.

I hope I didn't confuse u.Sorry if I did.Even I am a beginer.

Hope it works...All the best....

ali_mohammeda at 2007-7-12 10:36:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

tHANKS rahul

You have provide me solution in AJAX, its was pretty nice , but i am

actually looking for the solution in JSP

It would be simple to understand and easy for me.

Now i am not familier with AJAX. so better it would be javascript

or else whichever is easy.

Thanks for your suggestion.

b in touch

Ghanshyam

Ghanshyama at 2007-7-12 10:36:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...