Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Box(urgent)

Status
Not open for further replies.

ami7

Programmer
Oct 3, 2002
48
GB
Hi,

I have 2 text boxes in my form(.aspx)
when i type a value in first text box , i want that value to be displayed on my second text box simultaneously.
ie. Value should be displayed in the second text box when u r typing it in ur first textbox..

Is there any way to do this..
any scripts..

pls help.

Thanks,
ami.

 
Use javascript unless you want the page to do a post back then set autopostback to true.

Just a note don't put urgent into your title everyone thinks their problem is urgent! Makes ppl grouchy That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Hi,

Thanks for your reply and ur note.
sorry about that.

DO u have any sample script for the same? or any site url with such example.

Thanks.
ami

 
aha I got it. I was trying to write you a function before but it wasn't working not matter what I did. I went back to it just now and got it working like a charm.

Here you go.

Dim sb As New StringBuilder()
sb.Append(&quot;<Script Language=javascript>&quot;)
sb.Append(&quot;function Change() {&quot;)
sb.Append(&quot;document.getElementById('&quot;)
sb.Append(txt2.ID)
sb.Append(&quot;').value = document.getElementById('&quot;)
sb.Append(txt1.ID)
sb.Append(&quot;').value&quot;)
sb.Append(&quot;}&quot;)
sb.Append(&quot;</Script>&quot;)

RegisterStartupScript(&quot;Texter&quot;, sb.ToString)

txt1.Attributes.Add(&quot;OnChange&quot;, &quot;javascript:Change()&quot;)

This works perrrrfectly all client side and everything. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 

Mark,

That works fine...but only when u click ...but wat i want is to get typed simultaneously.

thanks for ur help..
ami.
 
I don't think that there is such an event handler.

You could I suppose do a workaround involving keypresses. But you would also need to make sure that the right text box had focus then just simple copy the key press to both boxes.

I would suggest looking for another way to do this, as it seems to be a small cosmetic change that would be hard to implement. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top