On Nov 19, 2:55*am, ruds <rudra...@gmail.comwrote:
Quote:
Hello,
I *have a JSP page in which HTML form elements are present.
I have a drop down list named Country, when a user selects his country
I want another drop down list to populate based on the first list the
names of coresponding states in that country.
For this I want to retrive values from database onchange event of the
first drop down list.
|
From the what of the what? You need to ask in a JSP group.
Quote:
My code is:
<HTML>
<HEAD>
<SCRIPT language=javascript>
|
Lose the language attribute. Use type="text/javascript".
Quote:
function Select_Index(form)
{
* var ctry = document.f1.Cntry.options
[document.f1.Cntry.selectedIndex].value
|
Don't assume that a form can be referenced as a property of the
document object (use the forms property.) Similar problem with
elements.
Quote:
|
* var HREF="./GetInfo.jsp?Ctry='"+ctry+"'"
|
Why CAPS? And why the funny URI?
Quote:
|
* window.open(HREF, "_self")}
|
Is this running in a frame?
Quote:
>
</SCRIPT>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>Country</TD>
<TD><select *name="Cntry" size="1" onchange="Select_Index(this.FORM)">
<%
* rs=stmt.executeQuery("select * from Country");
* while(rs.next()){
* * String cnt=rs.getString(2);
%>
* *<OPTION VALUE="<%=cnt%>"><%=cnt%></OPTION>
<%
* }
%>
|
Don't post server side code mixed with client side code (even if they
are both Javascript.)
[snip]
Quote:
>
As given in the above code onchange event of first drop down my
Select_Index function is called which reopens the page with attribute
ctry as parameter which is used in turn to populate my second drop
down list.
But this is not happening, please tell me how to achieve the same.
|
Start by expounding on "not happening."