Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to do it?

 
sachin shinde
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by chance sachin are you from kbp COE satara??
 
sachin shinde
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic