how i conditional access the data from database using combo box.
i have combox box named class when i select its value 11 or 12, another combo box appears named Subject values Arts, Commerce, Science.
how i conditional access the data from database when i select class 11 0r 12.
Here is JSP file:-
display.jsp:
<html>
<head>
<body>
<form name="form" >
<table align="center">
<script language="javascript">
function sendData(){
var sch=document.form.school.value;
var cla=document.form.class_name.value;
var y1=document.form.from_year.value;
var y2=document.form.to_year.value;
window.open("show.jsp?class_name="+cla+"&&from_year="+y1+"&&to_year="+y2+"&&school="+sch);
alert(sch+" "+cla+ " "+y1+" "+y2);
}
function hide(){
if (document.getElementById){
document.getElementById('combo').style.visibility = 'hidden';
}
}
function call(class_name){
var val = class_name.options[class_name.selectedIndex].text;
if((val=='11')||(val=='12')){
document.getElementById('combo').style.visibility = 'visible';
var arr = new Array();
arr[11] = new Array("Art","Commerce","Science");
arr[12] = new Array("Art","Commerce","Science");
var comboValue = class_name.value;
document.forms["form"].elements["combo2"].options.length=0;
for (var i=0;i<arr[comboValue].length;i++)
{
var option = document.createElement("option");
option.setAttribute('value',i+1);
option.innerHTML = arr[comboValue][i];
document.forms["form"].elements["combo2"].appendChild(option);
}
}
else{
document.getElementById('combo').style.visibility = 'hidden';
}
}
</script>
<body onload="hide();">
<p></p><br><br><br><br><br><br>
<tr><td style="width: 11px"> <span>Class</td> <td><select name="class_name" onchange="call(this); >
<%
for( int i=1;i<=12;i++){
%>
<option value="<%=i%>"><%=i%></option>
<%
}
%>
</select><td>
<select id="combo" name="combo2">
</select></td>
<tr><td style="width: 11px"> <span>From Year</td><td><select name="from_year">
<%
for(int j=2000;j<=2010;j++){
%>
<option value="<%=j%>"><%=j%></option>
<%
}
%>
</select></td></tr>
<tr><td style="width: 11px"> <span>To Year</td><td><select name="to_year">
<%
for(int k=2000;k<=2010;k++){
%>
<option value="<%=k%>"><%=k%></option>
<% } %>
</select></td></tr><td></td>
<tr><td style="width: 11px"> <span><input type="button" value="Result" onclick="sendData();"></td></tr>
<tr><td><input type="hidden" name="school" value="<%=request.getParameter("school")%>"></td></tr>
</table>
</form>
</body>
</head>
</html>
kindly help.
View Answers
Related Tutorials/Questions & Answers:
Populate a combo box using data from a databasePopulate a
combo box using data from a database Hi Guys, In need...
combo box which will then load the
next
combo box values,
now
i know
how... to the client
using ajax, and then populate the
combo box,
I must'nt reload
Advertisements
Acees data from database using combo box - JSP-ServletAcees
data from database using combo box please let me
how i access the
data from database when
i select
combo box combo2 having values Arts, Commerce, Science. this
combo box will appear when first
combo box class_name having
Retrieving Data from Database to fill Combo BoxRetrieving
Data from Database to fill
Combo Box Sir,
I have a JSP Page with a
combo box and a label.
I have a
database that has two fields id and an image. Now
I want to fill the
combo box with image and on selecting
Retrieving data from data base using jsp combo boxRetrieving
data from data base
using jsp
combo box Hi guys please...
combo box is there and another filed is version of the server(like 1.0,2.0) like... of the server it has to display the process name
from database into the process name
retrieving from oracle database using jsp combo boxretrieving
from oracle
database using jsp
combo box hi this is my code in this once
i select the server type and version of the server the process...
database please help on this
i need code
using servlets please help me .
<
retreiving data from microsoft access databaseretreiving
data from microsoft
access database
How can
i retrieve
data from microsoft
access when
i have select the vaules in
combo box and text
box. When
i select these values...
i want to retrieve the corresponding columns
how to get selected name from combo box how to get selected name
from combo box i have fetched all records of worker i.e worker name. on a test.jsp
and dispayed it into
combo box ...my... of worker name within d
combo box and display that id into a text
box.
plz
how to get selected name from combo box how to get selected name
from combo box i have fetched all records of worker i.e worker name. on a test.jsp
and dispayed it into
combo box ...my... of worker name within d
combo box and display that id into a text
box.
plz
how to get selected name from combo boxhow to get selected name
from combo box
i have fetched all records of worker i.e worker name. on a test.jsp
and dispayed it into
combo box ...my... of worker name within d
combo box and display that id into a text
box.
plz answer
how to get selected name from combo boxhow to get selected name
from combo box
i have fetched all records of worker i.e worker name. on a test.jsp
and dispayed it into
combo box ...my... of worker name within d
combo box and display that id into a text
box.
plz answer
how to get selected name from combo boxhow to get selected name
from combo box
i have fetched all records of worker i.e worker name. on a test.jsp
and dispayed it into
combo box ...my... of worker name within d
combo box and display that id into a text
box.
plz answer
Loading combo box from oracleLoading
combo box from oracle
how can
i load values into a combobox
from oracle
database when a value is selected in another
combo box jfreechart display from access database data.jfreechart display
from access database data.
I have made a
database... to retrieve the
data from the
access database using prepared statement and then display... is to be done in a servlet..
Note that it is a
access made
database.
How can
I How to access the database from JSP?How to
access the
database from JSP? Hi,
What is the process of accessing the
database from JSP page?
Thanks
Hi,
In the JSP program...
database from JSP which explains you
how to
access the
database by embedding
How to access (MySQL)database from J2ME?How to
access (MySQL)
database from J2ME?
I am new to J2ME.
I am
using NetBeans.
Can anyone help me?
How to
access (MySQL)
database from J2ME?
(
I search a lot
I found that there is need to
access database through servlet
How to get data from Oracle database using JSPHow to get
data from Oracle
database using JSP hello
i have a simple problem in jsp in the sense to get
data from the
database like oracle .
I have...
data from the
database like oracle),
I have created one jsp program like
How to access data yearly from DB in C# ?How to
access data yearly
from DB in C# ?
how to
access data yearly
from database in C#.
I have code but
i m not able to retrieve
data yearly
from... as Student_ID,payment
FROM fee" + ses + " where date1='" + date1
retrieve data from database using jsf retrieve
data from database using jsf Hello
I want an example of source code to retrieve
data from database
i have a
database (oracle) name as db1...),, name ,and city
I want after enter value in textbox according idauthor
i retrieve