473,379 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

two dropdown list getting data from access table

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
5 6632
r035198x
13,262 8TB
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
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
r035198x
13,262 8TB
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
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
r035198x
13,262 8TB
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

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

Similar topics

1
by: cvchen | last post by:
Hello, I'm implementing a data dictionary (catalogging system) that can be searched in several ways. I finished the first version without using any databases, I just had pickled dictionaries to...
1
by: jvb | last post by:
Hello, I have got the following problem. I have an access database with the name of different persons and there telephone numbers. In an access page you can display the field name and the...
1
by: bbdobuddy | last post by:
Hi, I have a connection to a SQL database. One of the tables in the SQL Database is DefendentInformation. I would like to get the firstName and lastName fields from that table combine them...
1
by: Leszek | last post by:
Hi I'm using this code to change a table cell into text input: pole=document.createElement("input"); pole.type="text"; pole.size="40"; pole.value=""+opis; pole.id="opis"+id;...
6
by: DavidOwens | last post by:
Hey everybody im creating a report for regional managers, i have created a table called STORES, what i want to be able to do is that when the page loads, it currents has the users name n id,...
7
by: arti | last post by:
In ASP.Net, I have a Dropdown List bound to a City Table with City Id as Value & City names as Data Text field. I want to Show a few Favourite Cities on top as well as in their correct place in the...
1
by: fran7 | last post by:
Hi, Anyone know how to populate a dropdown list with data from database. I have an interface that generates the following code for names in my database. ..asp <%If Trim(rsCard("Author"))<>""...
3
by: fish919 | last post by:
Hello All, I am creating a date base in access. I want to create a dropdown list box that is connected to another dropdown list box. You start with a dropdown list that has 5 choices and each of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.