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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
r pPosted Jan 21, 2009, 5:04 PM
Niradhip ChakrabortyPosted Jan 21, 2009, 4:32 PM
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 pPosted Jan 21, 2009, 7:23 AM
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.
anitha patibandlaPosted Jan 19, 2009, 11:33 AM
Hi
Here is solution
Goto TextChanged Event for CompanyAddress Text Box and write below
BillingAddress.text=CompanyAddress.text