how to display textbox value based on selected option value?

Ads

 
 

Share on Google+Share on Google+

k
how to display textbox value based on selected option value?
0 Answer(s)      5 years and 9 months ago
Posted in : Ajax
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
<[email protected] 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
Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Advertisements
Tutorials   
Java Spring Hibernate Struts Training Ajax java How to cascade two text boxes?? How to create runtime drag and drop form builder using asp.net mvc and jquery jsp+ajax validation JQuery-JSP AJAX example not working What is Ajax Framework How to write first example in Ajax? What are Advantages and Disadvantages of AJAX What is Ajax? how to set running watch with descending order in applycation with ajax how to set running watch with descending order in applycation with ajax jsp pages for dispatchaction for adding user to database c++ new, delete, string class using ajax i want to insert data into oracle database how to generate reports from oracle database using jsp and ajax code dynamic creation of multiple drop-down menus Ajax programming tutorials Displaying data from combobox on the web page Displaying data from combobox on the web page Displaying data from combobox on the web page Displaying data from combobox on the web page Displaying data from combobox on the web page What is Java? How to make a ajax application which take data from textarea and that page is not refreshing. how can add new line character into ajax response for java how can add new line character into ajax response for java c# c# asp.net Struts 2 + Ajax bodygaurd java Ajax mew 333 data insertion and fetch 1 my answer what is an ajax call? what is an ajax call? JSF How to easily send and receive recorders from database (in AJAX)? calculating time difference for manually entered in-time and out-time in hours and min for dynamically generated rows in jsp and display in third textfield. how to operate on select box using ajax in struts2? how to operate on select box using ajax in struts2? Auto Search box using ajax Dependant Dropdown Lists AJAX REGISTRATION FORM ajax code for jsp java i want to know how a slide will hide i want to know how a slide will hide

Ads

 
Advertisement null

Ads