aspose file tools*
The moose likes Servlets and the fly likes How to do it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to do it?" Watch "How to do it?" New topic
Author

How to do it?

sachin shinde
Greenhorn

Joined: Jul 05, 2001
Posts: 27
Hello friends,
There are two text box's. If i type some text in first text box it should automatically type in second text box. if anybody know how to do this, pl reply!!

Sachin

mou haj
Ranch Hand

Joined: Sep 12, 2001
Posts: 81
this is very simple...
when you populate a specific field and then when you take the cursor to the field where you wanna duplicate it is replicated .This can also be done on click of submit button.
Im pasting the code here you can also check this out from this url:
http://javascript.internet.com/forms/copy-name.html
********************** CODE **********************
<!-- ONE STEP TO INSTALL COPY NAME:
1. Copy the coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the BODY of your HTML document -->
<BODY>
<center>
<pre>
<form name=userform>
Name: <input type=text name=name size=15 value="" onChange="this.form.userid.value=this.value;"><br>
User ID: <input type=text name=userid size=15 value="" onChange="this.value=this.form.name.value;">
<p>
<input type=button name=action value="Done!">
</form>
</pre>
</center>
<p><center>
************************************************** )
mou haj
Ranch Hand

Joined: Sep 12, 2001
Posts: 81
by chance sachin are you from kbp COE satara??
sachin shinde
Greenhorn

Joined: Jul 05, 2001
Posts: 27
Hello friend
Thanks fro reply
I check that code but, It copied text after click on Button or click on next text box.
I want while typing in one text it should type in other text box.
Is it possible?
Again thanks for reply.
Pl give ur full name.
I am from Kolhapur.
Sachin
MattyMaT
Greenhorn

Joined: Sep 17, 2001
Posts: 1
First off all I don't think this topic is in the right category, because it's a JavaScript problem. But I'll try to help a little bit by replying with an allmost solution to your problem.
Instead of onChange, use onKeyPress or onKeyDown. Like this:

<form name="form1">
Field1
<input type="text" name="text1" onKeyPress="document.form1.text2.value = this.value">
<br>
Field2
<input type="text" name="text2">
</form>

Too bad it doesn't copy the last character! Maybe someone else knows how to do this?

Greetinx from MattyMaT
sachin shinde
Greenhorn

Joined: Jul 05, 2001
Posts: 27
Hello friend
Thanks for reply!
It works fine!
I will try to find out Last char prob.
Thanks for reply again
If i got solution i will post it here
If u get it PL give
bye
sachin
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to do it?