473,324 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How do I insert a char into the textfield on the keydown event of another textfield?

4
How do I insert a char into the textfield on the keypress event of another textfield?

I have two textboxes, "text1" and "text2".

[COLOR=DarkRed]Important:[/COLOR]
"text1" is outside the table.
"text2" is inside the table cell.

On the keydown/keypress/keyup event of "text1", the character which I entered in the "text1" must display in the textfield "text2".

Sample Code:
[HTML]<input type="text" name="text1" onkeypress="write(this)">
<table> //This is a dynamically generated table
<tr>
<td><input type="text" name="text2"></td>
</tr>
</table>
[/HTML]
For example,
Suppose If I enter srsh in "text1", "text2" should display the same.
At the same time, If I enter 'u' in between 's' and 'r' and 'e' in between 'r' and the second 's' in "text1", "text2" should now display "suresh".

And I want to know one more thing?
How can I get the position of the cursor of the textfield "text1"?
How can I set the position of the cursor of the textfield "text2"?

Can anyone please help me?

Regards,
Suresh.
Oct 24 '05 #1
1 3145
acoder
16,027 Expert Mod 8TB
Just set the value of the first text box to the second one:
Expand|Select|Wrap|Line Numbers
  1. var form = text1.form;
  2. var text2 = form.text2;
  3. text2.value = text1.value;
Oct 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Frank T. Clark | last post by:
How do I redirect or capture keydown events in a parent form from a child form? I have a main form which displays another informational form marked "SizableToolWindow". Form child = new...
3
by: bardo | last post by:
I have a Datagrid that is inside a panel. I want to use the keyDown event to reconize the arrow keys. But I have no luck at all. The problem is that the keydown event won't fire at all, unless I...
5
by: Flip | last post by:
I'm trying to create a form which a user can type out a key, and the CTRL-ALT-SHIFT keys are recognized (via ModifiedKeys object) and then pass the letter the user pressed to the windows API method...
4
by: Anne | last post by:
hie again, i have 3 textbox and i would like the user to go to the next textbox by pressing the 'ENTER' key. i have tried using this: Private Sub txtRequestor_KeyDown(ByVal sender As...
3
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the...
3
by: jimmy | last post by:
Hi all I am making a program whereby when the insert key is pressed in a text box it opens up another form with the search parameters they entered in the text box and automatically searches for...
2
by: Tarik Monem | last post by:
OK! I've gone through a few tutorials and I cannot understand what I'm doing wrong casting_registration.php <table> <tr> <td> <form enctype="multipart/form-data" action="thankyou.php"...
2
by: rsdev | last post by:
Hi, I have a stored procedure which is returning a blank id. Here's my code; SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings); SqlCommand cmd = new...
2
by: sush_jd via DotNetMonster.com | last post by:
I am using managed VC++ code in a Win Form App. There is a text box - txtRONumber. I have defined a KeyDown event handler (non-default) for it, like below. InitializeComponent() is being called...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.