By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,719 Members | 1,875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,719 IT Pros & Developers. It's quick & easy.

two dropdown list getting data from access table

P: 3
i am using java inside java script page.
in that page i want to use two dropdown list.
in first dropdown list i am getting data from ms-access database.
in second dropdown list i want to get data according to selection made in first dropdown list and it will also come from ms-access database.(for example if i am selecting country as india in first dropdown list then in second dropdown list will show states of india)

the problem is that i am not able to get the proper result in second dropdown list
i will be thankful if you give me proper solution to my problem
Mar 24 '08 #1
Share this Question
Share on Google+
5 Replies


10K+
P: 13,264
i am using java inside java script page.
in that page i want to use two dropdown list.
in first dropdown list i am getting data from ms-access database.
in second dropdown list i want to get data according to selection made in first dropdown list and it will also come from ms-access database.(for example if i am selecting country as india in first dropdown list then in second dropdown list will show states of india)

the problem is that i am not able to get the proper result in second dropdown list
i will be thankful if you give me proper solution to my problem
Why don't you post the code that you have and explain explain the results you want to get.
Mar 25 '08 #2

P: 3
Why don't you post the code that you have and explain explain the results you want to get.

the first dropdown list is for displaying project name and second dropdown list is for displaying approver name associated with selected project name in first dropdown list.
the problem is in second dropdown list the required data is not comming

<!-- project Name drop-down list -->


<tr>
<td><b><font color=blue>Project Name</font></b></td>

<% String CategoryCombo = null;%>

<td><SELECT NAME="pname" id= pname tabindex=5 onchange=location.href='pic_demo.jsp?option'=+this .value;>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();
Connection conn = DriverManager.getConnection("jdbc:odbc:Cab");
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery("select projname from login where desgn<>'A' group by projname");%>
<OPTION VALUE=0>Choose Project Name</OPTION>";
<%
while(rs.next())
{
CategoryCombo = rs.getString("projname");%>
<option value='<%=CategoryCombo%>' /><%out.println(CategoryCombo);%></option>
<% } %>

</SELECT></td>
</tr>


<!--- This is for approver dropdownlist --->

<tr>
<td><b><font color=blue>Approver</font></b></td>

<%
String ApproverCombo = null;%>
<td><SELECT NAME="Approver" id =Approver tabindex=6>
<OPTION VALUE=0>Choose Approver Name</OPTION>";
<%
ResultSet ss = statement.executeQuery("SELECT name from login where desgn='M' and projname='<%=CategoryCombo%>' ");
while(ss.next())
{
ApproverCombo = ss.getString("name");%>
<option value='<%=ApproverCombo%>' /><%out.println(ApproverCombo);%></option>
<% }
%>
</SELECT>
Mar 27 '08 #3

10K+
P: 13,264
That won't work. Remember the Java code is processed at the server and the Javascript at the client. Either use AJAX or load all the required values into a Javascript array on page load. You can then manipulate those values (select which ones to display) using Javascript on the client side based on the user's input.
Mar 27 '08 #4

P: 3
That won't work. Remember the Java code is processed at the server and the Javascript at the client. Either use AJAX or load all the required values into a Javascript array on page load. You can then manipulate those values (select which ones to display) using Javascript on the client side based on the user's input.

thanks for your reply..
i am new to jsp. can you send me code for this all and how to use AJAX in this case because i have to populate both dropdoun list from database..
Mar 28 '08 #5

10K+
P: 13,264
thanks for your reply..
i am new to jsp. can you send me code for this all and how to use AJAX in this case because i have to populate both dropdoun list from database..
The codes for that has been written thousands of times and is available all over the internet including in our very own Javascript/AJAX forum
Mar 28 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.