how to display textbox value based on selected option value?

Ads
 

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

Ads









Related Tutorials/Questions & Answers:
how to display textbox value based on selected option value?
how to generate automatic bill based on selected values using jsp/javascript?
Advertisements
HOW TO DISPLAY ID IN TEXTBOX BASED ON COMBOBOX SELECTION IN A SAME PAGE
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
How to show autocomplete textbox values on combo box option selection using database?
. Display JavaScript dropdown selected value
How to automatically change the value of the textbox based on the dropdown list?
For every option selected from a dropdown a new textbox opens
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
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 display current date in textbox - Date Calendar
I am not able to display the selected value of my combobox
how to use dropdown list in JSP and display value in same page
How to create textbox on combo value selection using javacsript in jsp?
How to insert dynamic textbox values into database using Java?
how to display selected checkboxes dynamically using jsp
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 get the values from dynamically generated textbox in java?
retaining textbox values
How to pass the value of Selected Value of combo box into sql ??
nested selected tag ihave display selected item
how to update combobx's selected value to database with respect toselected multiple checkboxes
How to insert data from a combobox and textbox values into DB using JSP?
How to Display an alert message when nothing is selected in jspinner in java?
how to get the value of a label field of option tag in javascript?
How to Display values from databse into table
how to display the selected row from the data table in model panel ??
fetch database value to text box based on selected value my code given below pls correct my code
fetch database value to text box based on selected value my code given below pls correct my code
How to execute mysql query based on checkboxes values in java swing application.

Ads