469,923 Members | 1,348 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

Copy information from one part of a form to another

I have a form that has a place for "Customer" and "CO-Customer" information.

I want to put a button by the CO-Customer section that will copy the Address
information from the Customer.

Do I have that button be a Submit button that posts the information back to
the form and the writes it?

Mike
Jul 19 '05 #1
7 2858
Posting back is an option, but I would say that client-side code is probably
more commonly used. Either that or just use a checkbox that lets the user
select "same address" or something and leave it at that.

Ray at home

"Mike" <mike4532> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
I have a form that has a place for "Customer" and "CO-Customer" information.
I want to put a button by the CO-Customer section that will copy the Address information from the Customer.

Do I have that button be a Submit button that posts the information back to the form and the writes it?

Mike

Jul 19 '05 #2
Hi,

You could do this easily using a JavaScript function, on the client side. Just on click of the button fire the JS function which copies the content from one form field to another. If u need any more help tell me, i can write u the code.

Regards,
Bhaskardeep Khaund
Jul 19 '05 #3
On Wed, 3 Dec 2003 16:50:27 -0700, "Mike" <mike4532> wrote:
I have a form that has a place for "Customer" and "CO-Customer" information.

I want to put a button by the CO-Customer section that will copy the Address
information from the Customer.

Do I have that button be a Submit button that posts the information back to
the form and the writes it?


Don't go server side for this. Check a Javascript group, there's
plenty of code snippets for this type of thing. An alternate would be
a DHTML setup, with hidden/unhidden code or the like.

Jeff
Jul 19 '05 #4
Bhaskardeep,

I would not even know where to start doing this.

It would be great if you could offer me some
more help.

Mike
"Bhaskardeep Khaund" <bh*********@hotmail.com> wrote in message news:#y**************@TK2MSFTNGP10.phx.gbl...
Hi,

You could do this easily using a JavaScript function, on the client side. Just on click of the button fire the JS function which copies the content from one form field to another. If u need any more help tell me, i can write u the code.

Regards,
Bhaskardeep Khaund

Jul 19 '05 #5
"Mike" <mike4532> wrote in message
news:ul**************@TK2MSFTNGP11.phx.gbl...
I have a form that has a place for "Customer" and "CO-Customer" information.
I want to put a button by the CO-Customer section that will copy the Address information from the Customer.

Do I have that button be a Submit button that posts the information back to the form and the writes it?

Mike


How about allowing the user to leave the CO-Customer address blank? This
is a common implementation on commerce sites. Billing address is
required (for credit card authentication) and you only need to provide a
shipping address if it's different from your billing address. Just a
thought. YMMV

-Chris Hohmann
Jul 19 '05 #6
HI,

Do like this:-

<html>
<head>
<title>New Page 1</title>
<Script Language="JavaScript">
function fnCopy(){
document.myform.box2.value = document.myform.box1.value;
}
</Script>
</head>
<body>
<form name="myform" mthod="post">
<p><textarea rows="2" name="box1" cols="20"></textarea></p>
<p><input type="button" value="Button" name="Copy Text from Box1 to Box2" onClick="javascript:fnCopy()"></p>
<p><textarea rows="2" name="box2" cols="20"></textarea></p>
</form>
</body>
</html>
Hope this Helps

Bhaskardep Khaund

Jul 19 '05 #7
It workes GREAT! Thanks.
"Bhaskardeep Khaund" <bh*********@hotmail.com> wrote in message news:uM**************@TK2MSFTNGP12.phx.gbl...
HI,

Do like this:-

<html>
<head>
<title>New Page 1</title>
<Script Language="JavaScript">
function fnCopy(){
document.myform.box2.value = document.myform.box1.value;
}
</Script>
</head>
<body>
<form name="myform" mthod="post">
<p><textarea rows="2" name="box1" cols="20"></textarea></p>
<p><input type="button" value="Button" name="Copy Text from Box1 to Box2" onClick="javascript:fnCopy()"></p>
<p><textarea rows="2" name="box2" cols="20"></textarea></p>
</form>
</body>
</html>
Hope this Helps

Bhaskardep Khaund
Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jean-Luc ERNST | last post: by
22 posts views Thread by Woody Splawn | last post: by
7 posts views Thread by lgbjr | last post: by
5 posts views Thread by Ajith Menon | last post: by
20 posts views Thread by Paul Bromley | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.