how to display textbox value based on selected option value?

how to display textbox value based on selected option value?

Hi,I have some problem. I use jsp and ajax.
first select: 1
second select:2 based on first value
 I finished above code.

ID: xx   Name:xx  xx is baesd on second and first value. But it is that l can't do that.


now, l post my code(not finished) here:
      function showdoc(id){
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/FYP/booking/getdocinfo.jsp"
url=url+"?doctor="+id
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged(){
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
    var showdata = xmlHttp.responseText;
    var strar = showdata.split(":");
      if(strar.length>1){
        var strname = strar[1];
        document.getElementById("doc_id").value= strar[1];
        document.getElementById("doc_name").value= strar[2];


         }
       }
     }


getdocinfo.jsp
<%@page language="java" import ="java.sql.*" %>
 <%
 Connection conn = null;
    String url = "jdbc:oracle:thin:@kk132.no-ip.org:1521:";
    String dbName = "XE";
    String driver = "oracle.jdbc.OracleDriver";
    String userName = "xx";
    String password = "xx";

 String doctor=request.getParameter("doctor").toString();
 String buffer="<tr><td>";
 Class.forName("oracle.jdbc.OracleDriver").newInstance();
 Connection con = DriverManager.getConnection(url+dbName,userName,password);
 Statement stmt = con.createStatement();
 String data="";
 ResultSet rs = stmt.executeQuery("Select * from DOCTOR where DOCTOR_ID='"+doctor+"'");
//out.print("<table border='1'>");
 //out.print("<tr><th>Employee ID</th>");
 //out.print("<th>Employee Name</th>");
//out.print("<th>Date</th>");
//out.print("<th>Time</th></tr>");
   while(rs.next()){

   data = ":" +rs.getString("DOCTOR_ID") +":"+ rs.getString("DOCTOR_NAME");

   }
 //buffer=buffer+"</td></tr></table>";
 System.out.println(data);
  //response.getWriter().println(data);


 %>
so, hope you help me. thanks
View Answers









Related Tutorials/Questions & Answers:
how to display textbox value based on selected option value?
. Display JavaScript dropdown selected value
Advertisements
How to show autocomplete textbox values on combo box option selection using database?
For every option selected from a dropdown a new textbox opens
how to generate automatic bill based on selected values using jsp/javascript?
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB
Javascript get Date And Selected Option Text
I want to display the quantity of the selected item of a drop down list in a textbox. The data is stored in database.
How to automatically change the value of the textbox based on the dropdown list?
How to display current date in textbox - Date Calendar
I am not able to display the selected value of my combobox
retaining textbox values
How to create textbox on combo value selection using javacsript in jsp?
how to display selected checkboxes dynamically using jsp
How to insert dynamic textbox values into database using Java?
Display values in textbox on selecting checkbox
how to get the values from dynamically generated textbox in java?
How to pass the value of Selected Value of combo box into sql ??
<html:option > with "selected" attribute - Struts
How to display on textbox using ObjectUtil class
How to insert data from a combobox and textbox values into DB using JSP?
how to use dropdown list in JSP and display value in same page
nested selected tag ihave display selected item
How to Display an alert message when nothing is selected in jspinner in java?
how to update combobx's selected value to database with respect toselected multiple checkboxes
how to display the selected row from the data table in model panel ??
How to Display values from databse into table
how to display the database values in pdf format
Retaining textBox values in java - Java Beginners
how to get the value of a label field of option tag in javascript?
how to know which jList is selected and according to that fetch the value
selected radiobutton to display different page
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....
how to display the value of termcell name in label
how to display values from database into table using jsp
select option value
select option value
display all the values on next page
get date picker values to a textbox
display he new customer no in textbox
store dynamic generated textbox value into database
Passing values in ComboBox from XML file
how to display each arraylist value on new page in jsp
display data from database in textbox when id entered in textbox
how to display the values of one list in other upon clicking a button in struts2
Java swing: get selected value from combobox

Ads