Dynamically adding textbox and labels

Dynamically adding textbox and labels

Sir, In my application I want to insert texbox and labels dynamically and want to insert database field value in that generated label. Plz help me, Thanks in advance.

View Answers

March 14, 2011 at 5:33 PM

1)ajax.jsp:

<%@page import="java.sql.*"%>
<html>
<head>
<script type="text/javascript">
function showData(value){ 

xmlHttp=GetXmlHttpObject()
var url="getdata.jsp";
url=url+"?name="+value;
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged() { 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
    var showdata = xmlHttp.responseText; 
    document.getElementById("lab").innerHTML="Address";
    document.getElementById("address").style.visibility="visible";
    document.getElementById("address").value= showdata;
        } 
}
function GetXmlHttpObject(){
var xmlHttp=null;
try {
  xmlHttp=new XMLHttpRequest();
 }
catch (e) {
 try  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
</script>
</head>
<body>
<form name="employee">
<br><br>
<pre>
<label>Name</label>     <input  type="text" name="name" id="name" onkeyup="showData(this.value);">
<label id="lab">       </label>  <input style="visibility:hidden" type="text" name="address" id="address">
</form>    
</html>

2)getdata.jsp:

<%@ page import="java.sql.*" %> 
<%
String name = request.getParameter("name").toString();
System.out.println(name);
String data ="";
try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from employee where name='"+name+"'");
while(rs.next())
{
data =rs.getString("address");
}
out.println(data);
System.out.println(data);
}
catch (Exception e) {
System.out.println(e);
}
%>









Related Tutorials/Questions & Answers:
Dynamically adding textbox and labels
Dynamically adding textbox and labels  Sir, In my application I want to insert texbox and labels dynamically and want to insert database field value in that generated label. Plz help me, Thanks in advance
having difficulties in dynamically adding textbox with datepicker
having difficulties in dynamically adding textbox with datepicker  hi... add new row of textbox. And also able to use datepicker for the textbox as well. However, I am able to add and display the textbox but not the datepicker. I
Advertisements
Dynamically hide textbox
Dynamically hide textbox  I have a drop down(combo box) with 2 values (reference and file).When refrence is selected from the drop down the components of file(that is displayed when file is selected) should get hidden dynamically
jtable-adding a row dynamically
jtable-adding a row dynamically  hi..i am doing a project for pharmacy .. *pblm:* when i want to enter the details in jtable while running... to add one more row dynamically as a new row 4th if the details are large.but every
How to display gridview details to labels dynamically?
How to display gridview details to labels dynamically?  I am using SQLDataSource to connect to MySQL. I have a gridview that retrieves information... the gridview results on labels. I used lbDate.Text = GridView1.Rows(0).Cells(0).Text
Dynamically Update textbox from database
Dynamically Update textbox from database  I have a database as shown... with two text boxes. if I type something in one textbox, the corresponding value... in another textbox. How can I achieve
how to get the values from dynamically generated textbox in java?
how to get the values from dynamically generated textbox in java?  I... textbox corresponding to the data. I want to get data from textboxes(generated as per the retrieved data) and I want to store textbox values into the two table
display data from database in textbox when id entered in textbox
display data from database in textbox when id entered in textbox  i wanted to enter data in textbox .depending on entered data in textbox data from database should be displayed dynamically in textbox
ModuleNotFoundError: No module named 'labels'
ModuleNotFoundError: No module named 'labels'  Hi, My Python... 'labels' How to remove the ModuleNotFoundError: No module named 'labels'... to install padas library. You can install labels python with following command
labels,textfields,buttons
labels,textfields,buttons  how to set the labels,textfields,buttons at certain positions such that we can add them without layout managers? my program is to design a login page with image and these labels at exact positions
Labels in Struts 2.0 - Struts
Labels in Struts 2.0   Hello, how to get the Label name from properties file
store dynamic generated textbox value into database
store dynamic generated textbox value into database  sir, how do i store dynamically generated textbox value into the database thanks in advance
ModuleNotFoundError: No module named 'chord-labels'
ModuleNotFoundError: No module named 'chord-labels'  Hi, My Python... 'chord-labels' How to remove the ModuleNotFoundError: No module named 'chord-labels' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'unwrap-labels'
ModuleNotFoundError: No module named 'unwrap-labels'  Hi, My... 'unwrap-labels' How to remove the ModuleNotFoundError: No module named 'unwrap-labels' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'chord-labels'
ModuleNotFoundError: No module named 'chord-labels'  Hi, My Python... 'chord-labels' How to remove the ModuleNotFoundError: No module named 'chord-labels' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'crr-labels'
ModuleNotFoundError: No module named 'crr-labels'  Hi, My Python... 'crr-labels' How to remove the ModuleNotFoundError: No module named 'crr-labels' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'sanitize-ml-labels'
ModuleNotFoundError: No module named 'sanitize-ml-labels'  Hi, My... named 'sanitize-ml-labels' How to remove the ModuleNotFoundError: No module named 'sanitize-ml-labels' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-taggit-labels'
ModuleNotFoundError: No module named 'django-taggit-labels'  Hi...: No module named 'django-taggit-labels' How to remove the ModuleNotFoundError: No module named 'django-taggit-labels' error? Thanks   Hi
ModuleNotFoundError: No module named 'docker-auto-labels'
ModuleNotFoundError: No module named 'docker-auto-labels'  Hi, My... named 'docker-auto-labels' How to remove the ModuleNotFoundError: No module named 'docker-auto-labels' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-taggit-labels'
ModuleNotFoundError: No module named 'django-taggit-labels'  Hi...: No module named 'django-taggit-labels' How to remove the ModuleNotFoundError: No module named 'django-taggit-labels' error? Thanks   Hi
How to create textbox on combo value selection using javacsript in jsp?
How to create textbox on combo value selection using javacsript in jsp?  dynamically create textbox on combo value selection. when select multiple values then create multiple textboxes
dynamically writing text javascript
dynamically writing text javascript  dynamically writing text javascript. Is it possible
dynamically writing text javascript
dynamically writing text javascript  dynamically writing text javascript. Is it possible
Adding an employee
Adding an employee  coding for adding an employee
adding a dialogue
adding a dialogue  Blockquote Hi can you help with the program below,the program is a loop that prints out a code and a quantity when prompt for the user input.what I need is to modify the code to incorporate a dialogue asking
adding loop
adding loop  Hi I have a program that is not compiling when I add a loop can you help me?The program below is compiling without the loop. > Blockquote mport java.util.*; import java.text.*; import java.util.Scanner
Hibernate :dynamically choosing server
Hibernate :dynamically choosing server   Is it possible to dynamically choose server name in hibernate
showing the information of database in textbox
showing the information of database in textbox  how to make a information of a database make appear to the user in the textbox
Getting mysql table in textbox
Getting mysql table in textbox  how to get mysql table values into textbox in java using ajax and servlets
change xml dynamically
change xml dynamically  How to change an XML dynamically in Java
Background color blocks all labels and textfields
Background color blocks all labels and textfields  I added background color but I dont see textfields and labels anymore, please help. What am I missing? (" JFrame f = new JFrame(); SchoolOption f1 = new SchoolOption(); Color c
populate Combo Box dynamically
populate Combo Box dynamically  Hi, How to populate the Combo Box dynamically using Flex with Jsp's
retrieving values from dynamically added textboxes in jsp - JSP-Servlet
retrieving values from dynamically added textboxes in jsp  hai friends, iam new to this site ,please help me in this senario in jsp how to retrieve values from dynamically added textbox like we can see in naukri.com
listbox and textbox validations
listbox and textbox validations  hi, any one please tell me how to set validations for listbox and textboxes using bean classes? thank you   Please visit the following link: http://www.roseindia.net/jsp/user
retaining textbox values
retaining textbox values  i have a calculator program, when i press a button the value displays but disappears when i press another button so how can i keep values to display when i press multiple buttons
Dyanmically Adding Rows with Date Picker
Dyanmically Adding Rows with Date Picker  Hi Sir, I am doing a project in that i need to add rows dynamically with date picker inside row, send me code as soon as possible. Regards, Santhosh
Dynamically creating a form in gwt?
Dynamically creating a form in gwt?  how can i create a gwt form by retrieving fields dynamically from a map? i have all the fields set in the data base and i am retrieving them in a map and i want to create fields dynamically
date in textbox on page load
date in textbox on page load   i want to insret the current date in textbox but this code dosen't work and the value of text box will be blank... into textbox on page load. <html> <script> function addDate(){ date = new
UITextView Change Height dynamically
UITextView Change Height dynamically  dynamically expand the height of UITextView.   - (void) textViewDidEndEditing:(UITextView *)textView { CGRect frame = mTextView.frame; frame.size.height
javascript for textbox - JSP-Servlet
javascript for textbox  Dear sir , How to write a javascript for a textbox ?.I am doing a delet operation.When i clik on a particular record that record should be deleted before deleting it an alert message is shown
Sql Server 2008 with textbox
Sql Server 2008 with textbox  **Hi, I tried to insert into DB using textbox in a form using vb by visual studio 2010 but its always catch an error [Cannot open database "4" requested by the login. The login failed. Login failed
Add color to background but I can't labels or textfields
Add color to background but I can't labels or textfields  Please help me to fix this. public static void main(String[] args) { JFrame f = new JFrame(); SchoolOption f1 = new SchoolOption(); Color c
Store values of dynamically generated textboxes into database
Store values of dynamically generated textboxes into database   I'm trying to create a form where the user gives number to generate textboxes. when for example the user enters 3 into textbox, three text boxes get generated
Dynamically Servlet progress
Dynamically Servlet progress   Hi all, My question is , when am running a servlet using ajax. It returning the response after servlet processing. Is there any way to get the response from the servlet after some progress. Please
populating textbox value from the database using onchange function,
populating textbox value from the database using onchange function,  hi, Everyone I have a problem regarding poulatinng the value in textbox after... dynamically from the database(mysql). after selecting the value from the dropd
Ajax drop down and textbox
;And one more thing how to insert to the database dynamically
get date picker values to a textbox
get date picker values to a textbox  I am using DatePicker to select date in a form in asp.net using c#. I need the picked data to get in to a textbox. Please help me soon
display he new customer no in textbox
display he new customer no in textbox   i want to add the new customer for that when i click on add butto the new customernumber should be display in textfield . plz ell me the suggestions & code
Dyanmically Adding Rows
Dyanmically Adding Rows  Hi sir Am doing project in that i need to add date picker in dynamically adding rows but the dates are storing in first test box only ill paste my code debug that code as soon as possible. Regards
getting result in table dynamically - Struts
getting result in table dynamically  How do i get result in tabular format dynamically using our own tags

Ads