Solved

Putting form data from one form to another form

Posted on 2000-04-29
6
201 Views
Last Modified: 2010-04-09
I have a form.  When a person fills it out I want that data to populate some fields in a different form.

What is the quick and easy way to do this?

Michael
0
Comment
Question by:morya
  • 2
  • 2
  • 2
6 Comments
 

Expert Comment

by:ianand
ID: 2763345
There are ways to do it using a back end tools, like ASP etc. but on the clients side I doubt there is any avaliable thing which can do this.

1. You can try to use dhtml in the same page and hide the previoud data and put the new data.

2. Else, Open a new window with a handle and use window.document handle to write to the new window.

Hope this will help you.
If you want any specific code ,please specify.
0
 

Author Comment

by:morya
ID: 2764091
I don't know asp.  Would it be something I could just patch in the html code?

I'm not sure what you mean with using a handle in a new window.

Could you explain?

Michael
0
 

Expert Comment

by:ianand
ID: 2770571
x=window.open('xyz.html','Title,"...");
Here x is the handle for the new window.
What you have to do is build up your complete page based on x.document.write
Javascript. This is generally used for some small display of help but not for a full fledged web page( Though you may use it).

If you are not using any server side contents ( ASP, Perl etc. ) then apart from already mentioned you can also try
it with
1.  cookies. Build a cookie in parent form and read it in the new form.
2.  Transfer the data as a parameter in the href and use substring of the href script using javascript.

If you tell me the code Maybe I can help you better.
Anand
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Expert Comment

by:rhinosaur
ID: 2780087
Easiest way would be to use JavaScript which would be relatively easy to do.
0
 

Author Comment

by:morya
ID: 2781210
rhinosaur,

Do you have any java script code or point me to some?
0
 
LVL 1

Accepted Solution

by:
rhinosaur earned 50 total points
ID: 2787704
A great site for JavaScript stuff (e.g. forms) is at:

http://javascript.internet.com/forms/

For example, this one:

<!-- TWO STEPS TO INSTALL COPY FIELDS:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var ShipFirst = "";
var ShipLast = "";
var ShipEmail = "";
var ShipCompany = "";
var ShipAddress1 = "";
var ShipAddress2 = "";
var ShipCity = "";
var ShipState = "";
var ShipStateIndex = 0;
var ShipZip = "";
var ShipConfirm = 0;

function InitSaveVariables(form) {
ShipFirst = form.ShipFirst.value;
ShipLast = form.ShipLast.value;
ShipEmail = form.ShipEmail.value;
ShipCompany = form.ShipCompany.value;
ShipAddress1 = form.ShipAddress1.value;
ShipAddress2 = form.ShipAddress2.value;
ShipCity = form.ShipCity.value;
ShipZip = form.ShipZip.value;
ShipStateIndex = form.ShipState.selectedIndex;
ShipState = form.ShipState[ShipStateIndex].value;
ShipConfirm = form.ShipConfirm.checked;
}

function ShipToBillPerson(form) {
if (form.copy.checked) {
InitSaveVariables(form);
form.ShipFirst.value = form.BillFirst.value;
form.ShipLast.value = form.BillLast.value;
form.ShipEmail.value = form.BillEmail.value;
form.ShipCompany.value = form.BillCompany.value;
form.ShipAddress1.value = form.BillAddress1.value;
form.ShipAddress2.value = form.BillAddress2.value;
form.ShipCity.value = form.BillCity.value;
form.ShipZip.value = form.BillZip.value;
form.ShipState.selectedIndex = form.BillState.selectedIndex;
form.ShipConfirm.checked = form.BillConfirm.checked;
}
else {
form.ShipFirst.value = ShipFirst;
form.ShipLast.value = ShipLast;
form.ShipEmail.value = ShipEmail;
form.ShipCompany.value = ShipCompany;
form.ShipAddress1.value = ShipAddress1;
form.ShipAddress2.value = ShipAddress2;
form.ShipCity.value = ShipCity;
form.ShipZip.value = ShipZip;      
form.ShipState.selectedIndex = ShipStateIndex;
form.ShipConfirm.checked = ShipConfirm;
   }
}
//  End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<center>
<form method="post" action="http://www.your-web-site-address-here.com/script.cgi" name="billform">
<table border="1" cellspacing="0" cellpadding="3" width="400">

<tr bgcolor="#003399">
<td colspan=2 width="100%" bgcolor="#003399">
<b><font color=white size="-1" face="arial, helvetica">Billing Information</font></b>
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">First Name:</font>
</td>
<td>
<input type="text" size="15" maxlength="50" name="BillFirst">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">Last Name:</font>
</td>
<td>
<input type="text" size="15" maxlength="50" name="BillLast">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">E-Mail:</font>
</td>
<td>
<input type="text" size="15" name="BillEmail">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">Company:</font>
</td>
<td>
<input type="text" size="25" maxlength="100" name="BillCompany">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">Address:</font>
</td>
<td>
<input type="text" size="40" maxlength="35" name="BillAddress1">
</td>
</tr>
<tr>
<td>
 
</td>
<td>
<input type="text" size="40" maxlength="35" name="BillAddress2">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">City:</font>
</td>
<td>
<input type="text" size="25" maxlength="21" name="BillCity">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">State:</font>
</td>
<td>
<select name="BillState">
<option selected>
<option value="AL">ALABAMA
<option value="AK">ALASKA
<option value="AZ">ARIZONA
<option value="AR">ARKANSAS
<option value="CA">CALIFORNIA
<option value="CO">COLORADO
<option value="CT">CONNECTICUT
<option value="DE">DELAWARE
<option value="FL">FLORIDA
<option value="GA">GEORGIA
<option value="HI">HAWAII
<option value="ID">IDAHO
<option value="IL">ILLINOIS
<option value="IN">INDIANA
<option value="IA">IOWA
<option value="KS">KANSAS
<option value="KY">KENTUCKY
<option value="LA">LOUISIANA
<option value="ME">MAINE
<option value="MD">MARYLAND
<option value="MA">MASSACHUSETTS
<option value="MI">MICHIGAN
<option value="MN">MINNESOTA
<option value="MS">MISSISSIPPI
<option value="MO">MISSOURI
<option value="MT">MONTANA
<option value="NE">NEBRASKA
<option value="NV">NEVADA
<option value="NH">NEW HAMPSHIRE
<option value="NJ">NEW JERSEY
<option value="NM">NEW MEXICO
<option value="NY">NEW YORK
<option value="NC">NORTH CAROLINA
<option value="ND">NORTH DAKOTA
<option value="OH">OHIO
<option value="OK">OKLAHOMA
<option value="OR">OREGON
<option value="PA">PENNSYLVANIA
<option value="RI">RHODE ISLAND
<option value="SC">SOUTH CAROLINA
<option value="SD">SOUTH DAKOTA
<option value="TN">TENNESSEE
<option value="TX">TEXAS
<option value="UT">UTAH
<option value="VT">VERMONT
<option value="VA">VIRGINIA
<option value="WA">WASHINGTON
<option value="DC">WASHINGTON, D.C.
<option value="WV">WEST VIRGINIA
<option value="WI">WISCONSIN
<option value="WY">WYOMING
</select>
 
<input type="text" size="10" maxlength="10" name="BillZip">
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type="checkbox" name="BillConfirm" selected> <font face="arial, helvetica" size="-2">Send confirmation email via email</font>
</td>
</tr>


<tr bgcolor="#003399">
<td colspan=2 width="100%" bgcolor="#003399">
<b><font color=white size="-1" face="arial, helvetica">Shipping Information</font></b>
<font color=white size="-2" face="arial, helvetica">
(Check to use Billing Information: <input type="checkbox" name="copy"
OnClick="javascript:ShipToBillPerson(this.form);" value="checkbox"> )
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">First Name:</font></td>
<td>
<input type="text" size="15" maxlength="50" name="ShipFirst">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">Last Name:</font>
</td>
<td>
<input type="text" size="15" maxlength="50" name="ShipLast">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">E-Mail:</font>
</td>
<td>
<input type="text" size="15" name="ShipEmail">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">Company:</font>
</td>
<td>
<input type="text" size="25" maxlength="100" name="ShipCompany">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">Address:</font>
</td>
<td>
<input type="text" size="40" maxlength="35" name="ShipAddress1">
</td>
</tr>
<tr>
<td>
 
</td>
<td>
<input type="text" size="40" maxlength="35" name="ShipAddress2">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">City:</font>
</td>
<td>
<input type="text" size="25" maxlength="21" name="ShipCity">
</td>
</tr>
<tr>
<td>
<font size="-1" face="arial, helvetica">State:</font>
</td>
<td>
<select name="ShipState">
<option selected>
<option value="AL">ALABAMA
<option value="AK">ALASKA
<option value="AZ">ARIZONA
<option value="AR">ARKANSAS
<option value="CA">CALIFORNIA
<option value="CO">COLORADO
<option value="CT">CONNECTICUT
<option value="DE">DELAWARE
<option value="FL">FLORIDA
<option value="GA">GEORGIA
<option value="HI">HAWAII
<option value="ID">IDAHO
<option value="IL">ILLINOIS
<option value="IN">INDIANA
<option value="IA">IOWA
<option value="KS">KANSAS
<option value="KY">KENTUCKY
<option value="LA">LOUISIANA
<option value="ME">MAINE
<option value="MD">MARYLAND
<option value="MA">MASSACHUSETTS
<option value="MI">MICHIGAN
<option value="MN">MINNESOTA
<option value="MS">MISSISSIPPI
<option value="MO">MISSOURI
<option value="MT">MONTANA
<option value="NE">NEBRASKA
<option value="NV">NEVADA
<option value="NH">NEW HAMPSHIRE
<option value="NJ">NEW JERSEY
<option value="NM">NEW MEXICO
<option value="NY">NEW YORK
<option value="NC">NORTH CAROLINA
<option value="ND">NORTH DAKOTA
<option value="OH">OHIO
<option value="OK">OKLAHOMA
<option value="OR">OREGON
<option value="PA">PENNSYLVANIA
<option value="RI">RHODE ISLAND
<option value="SC">SOUTH CAROLINA
<option value="SD">SOUTH DAKOTA
<option value="TN">TENNESSEE
<option value="TX">TEXAS
<option value="UT">UTAH
<option value="VT">VERMONT
<option value="VA">VIRGINIA
<option value="WA">WASHINGTON
<option value="DC">WASHINGTON, D.C.
<option value="WV">WEST VIRGINIA
<option value="WI">WISCONSIN
<option value="WY">WYOMING
</select>
 
<input type="text" size="10" maxlength="10" name="ShipZip">
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type="checkbox" name="ShipConfirm" selected> <font face="arial, helvetica" size="-2">Send confirmation email via email</font>
</td>
</tr>
</table>
</form>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  8.75 KB -->

Hope that helps.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
2 CSS questions 11 35
Syntax Error 6 30
Fire Fox doesn't show calendar on html page ? 5 47
Library to convert HTML to PDF. 8 44
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now