Chris__T
Posts: 339
|
Posted: 04/09/2008, 7:18 AM |
|
I'm trying to copy name,address,city,state,zip fields from a set of textboxes to another set of textboxes below them, using a button. I tried to do this in an on-click event, setting the values of the new textboxes to the values of the old textboxes.
form1.Name2textbox.value = form1.name1textbox.value
etc....
but clicking the button doesn't do anything. Any suggestions?
|
|
|
micjon
Posts: 8
|
Posted: 04/09/2008, 7:47 AM |
|
Be sure you are putting the logic in javascript on the client-side rather than using the server-side event for OnClick.
|
|
|
Chris__T
Posts: 339
|
Posted: 04/09/2008, 8:05 AM |
|
Ah, ok. I was server side.
Can I set the value of the textboxes the same way I did on server-side? Or is there a special way in javascript? I'm not to familiar with javascript.
|
|
|
mljonzs
Posts: 124
|
Posted: 04/09/2008, 9:47 AM |
|
There are a couple of ways to do it in javascript.
The easiest way is to use something like:
document.forms["form1"].Name2textbox.value = document.forms["form1"].Name1textbox.value;
Keep in mind that javascript, unlike ASP, is case-sensitive so you need to really be careful
Hope this helps.
_________________
What does not begin WITH God, will end in failure!
|
|
|
Chris__T
Posts: 339
|
Posted: 04/09/2008, 10:01 AM |
|
Thanks. That helped. I also read through some javascript tutorials online and was able to even append textbox date into one box (like putting first name and last name text boxes into one box) Thanks for your help!
|
|
|
mljonzs
Posts: 124
|
Posted: 04/10/2008, 10:05 AM |
|
Glad it helped. Some of this stuff can be frustrating at first, but once you get used to it, CCS is really cool and nice to work with.
Good Luck!
_________________
What does not begin WITH God, will end in failure!
|
|
|
|