I have two textboxes in the same page-
1. CompanyAddress and
2. BillingAddress.
I want to copy CompanyAddress to
BillingAddress while the user is typing in CompanyAddress.
Is there any way to do it?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
anitha patibandla7 reputationPosted Jan 19, 2009, 6:33 AM EST
Hi
Here is solution
Goto TextChanged Event for CompanyAddress Text Box and write below
BillingAddress.text=CompanyAddress.text
r pRank #4,639 · 333 reputationPosted Jan 21, 2009, 2:23 AM EST
Because my textboxes are in the ContentPlaceHolder which is in the MasterPage.
My javascript function for copying textbox value is as follows.
The above code is given in the .aspx page
Now, I have TextBox1 and TextBox2 in my ContentPlaceHolder called MainContent.
I want to pass these two textboxes to the above function.
I could not find a solution yet.
I have 6 textboxes like this. That is why I am trying to pass the text box to the function. Otherwise I will
have to make 6 functions like this which looks bad.
Niradhip ChakrabortyRank #429 · 5.8K reputationPosted Jan 21, 2009, 11:32 AM EST
I dont think it is the proper way to do it. You need to call the function on 'OnBlur' event of textbox2.(incase of coping the textbox2 data in textbox1).
syntax should be like this:
function FnCopyTextBox()
{
document.getElementById("TextBox1").value = document.getElementById("TextBox2").value ;
}
r pRank #4,639 · 333 reputationPosted Jan 21, 2009, 12:04 PM EST