Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 09:56 AM
Mike
Guest
 
Posts: n/a
Default 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


  #2  
Old July 19th, 2005, 09:56 AM
Ray at
Guest
 
Posts: n/a
Default Re: Copy information from one part of a form to another

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:uls$sffuDHA.1576@TK2MSFTNGP11.phx.gbl...[color=blue]
> I have a form that has a place for "Customer" and "CO-Customer"[/color]
information.[color=blue]
>
> I want to put a button by the CO-Customer section that will copy the[/color]
Address[color=blue]
> information from the Customer.
>
> Do I have that button be a Submit button that posts the information back[/color]
to[color=blue]
> the form and the writes it?
>
> Mike
>
>[/color]


  #3  
Old July 19th, 2005, 09:57 AM
Bhaskardeep Khaund
Guest
 
Posts: n/a
Default Re: Copy information from one part of a form to another

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
  #4  
Old July 19th, 2005, 09:57 AM
Jeff Cochran
Guest
 
Posts: n/a
Default Re: Copy information from one part of a form to another

On Wed, 3 Dec 2003 16:50:27 -0700, "Mike" <mike4532> wrote:
[color=blue]
>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?[/color]

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
  #5  
Old July 19th, 2005, 09:58 AM
Mike
Guest
 
Posts: n/a
Default Re: Copy information from one part of a form to another

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" <bhaskar_999@hotmail.com> wrote in message news:#ysf4EluDHA.2432@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

  #6  
Old July 19th, 2005, 09:58 AM
Chris Hohmann
Guest
 
Posts: n/a
Default Re: Copy information from one part of a form to another

"Mike" <mike4532> wrote in message
news:uls$sffuDHA.1576@TK2MSFTNGP11.phx.gbl...[color=blue]
> I have a form that has a place for "Customer" and "CO-Customer"[/color]
information.[color=blue]
>
> I want to put a button by the CO-Customer section that will copy the[/color]
Address[color=blue]
> information from the Customer.
>
> Do I have that button be a Submit button that posts the information[/color]
back to[color=blue]
> the form and the writes it?
>
> Mike[/color]

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


  #7  
Old July 19th, 2005, 09:58 AM
Bhaskardeep Khaund
Guest
 
Posts: n/a
Default Re: Copy information from one part of a form to another

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

  #8  
Old July 19th, 2005, 09:58 AM
Mike
Guest
 
Posts: n/a
Default Re: Copy information from one part of a form to another

It workes GREAT! Thanks.
"Bhaskardeep Khaund" <bhaskar_999@hotmail.com> wrote in message news:uMORcRquDHA.1744@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


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles