473,695 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

two dropdown list getting data from access table

3 New Member
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 6654
r035198x
13,262 MVP
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
abhi3211
3 New Member
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>Proj ect Name</font></b></td>

<% String CategoryCombo = null;%>

<td><SELECT NAME="pname" id= pname tabindex=5 onchange=locati on.href='pic_de mo.jsp?option'= +this.value;>
<%
Class.forName(" sun.jdbc.odbc.J dbcOdbcDriver") .newInstance();
Connection conn = DriverManager.g etConnection("j dbc:odbc:Cab");
Statement statement = conn.createStat ement();
ResultSet rs = statement.execu teQuery("select projname from login where desgn<>'A' group by projname");%>
<OPTION VALUE=0>Choose Project Name</OPTION>";
<%
while(rs.next() )
{
CategoryCombo = rs.getString("p rojname");%>
<option value='<%=Categ oryCombo%>' /><%out.println( CategoryCombo); %></option>
<% } %>

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


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

<tr>
<td><b><font color=blue>Appr over</font></b></td>

<%
String ApproverCombo = null;%>
<td><SELECT NAME="Approver" id =Approver tabindex=6>
<OPTION VALUE=0>Choose Approver Name</OPTION>";
<%
ResultSet ss = statement.execu teQuery("SELECT name from login where desgn='M' and projname='<%=Ca tegoryCombo%>' ");
while(ss.next() )
{
ApproverCombo = ss.getString("n ame");%>
<option value='<%=Appro verCombo%>' /><%out.println( ApproverCombo); %></option>
<% }
%>
</SELECT>
Mar 27 '08 #3
r035198x
13,262 MVP
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
abhi3211
3 New Member
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 MVP
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
1757
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 store the data and I unpickled files as necessary to get at search results, that worked just fine for me. Problem is, my boss wants me to integrate the data into MS Access because my project will eventually become part of a larger project.
1
1670
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 telephone number. What i want to do is a combobox in wich you can select the name and the the right telephonenumber has to be shown! I CANT FIGURE IT OUT HOW TO DO THIS. IT LOOKS SIMPLE BUT ........
1
1367
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 and add that as a value to the drop down list. However, I don't know what to put in for the datasource property.
1
7370
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; pole.name="opis"+id; pole.className="guzik1";
6
5530
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, but in the days columns mon-sat its empty, and i would like to hace those colums contain drop down lists of the stores from the stores table and save by default when the page next loads, so they dont have to keep going through the dropdown lists. iv...
7
1714
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 Dropdown List. Help!
1
1867
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"))<>"" Then%> <%=rsCard("Author")%><%End If%> .. How does one populate a dropdown list??
3
2800
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 these choices will call another dropdown list box when one of the choices from the first gets selected. (I hope this makes sense) All of this is being done on a single form. I know how to make a (sub) dropdown list not seen before the action...
0
8639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8582
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9120
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4586
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2279
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1980
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.