?
Solved

How do you populate billing address with information from the same page with a button?

Posted on 2008-11-07
3
Medium Priority
?
259 Views
Last Modified: 2012-05-05
This is an asp page. Using html, javascript and asp.
On this page I collect address information, Street, City, State, Zip. Later down the page I have where you put in your credit card information. Does anyone have sample code where I can click a button that says 'Same as Personal Information' and it would populate card Street, City, state, Zip with the information they already entered?

Also the cardname is one field, I would need it to combine the first  and last names from the earlier up the page.


<!-- Name from the personal info -->
<tr valign="bottom">
<td class="bluetxt">First Name*</td>
<td><input name="FirstName" value="<%Response.Write request.form("FirstName")%>" type="text" id="Text3"></td>
</tr>
 
<tr valign="bottom">
<td class="bluetxt">Last Name*</td>
<td><input name="LastName" value="<%Response.Write request.form("LastName")%>" type="text" id="Text4"></td>
</tr>
 
<!-- Street and city from the personal info -->
<tr valign="bottom">
<td><nobr><font color=""#ff0000"">Street* </font></nobr>
</td>
<td valign="bottom" colspan="2">
<input name="Address1" value="<%Response.Write request.form("Address1")%>" type="text" id="Text12" size="30">
</td>
 
<tr valign="bottom">
<td><font color=""#ff0000"">City*</font></td>
<td colspan="2">
<input name="AddressCity" value="<%Response.Write request.form("AddressCity")%>" type="text" id="Text15" size="30"></td>
</tr>
 
 
<!-- Name, CardStreet and City from later in the page -->
<TR>
<td width="126" height="30">
<b>Name on card:</b>
</td>
<td height="30">
<input type="text" value="" name="cardName" size="20" maxlength=20>
</td>
</TR>
<TR>
<td width="126" height="30">
<b>Street:</b>
</td>
<td height="30">
<input type="text" value="" name="CardStreet" size="15" maxlength=50>
</td>
</TR>
							
<TR>
<td width="126" height="30">
<b>City:</b>
</td>
<td height="30">
<input type="text" value="" name="CardCity" size="15" maxlength=50>
</td>
</TR>

Open in new window

0
Comment
Question by:seahawk9
  • 3
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 22908972
try something like the attached script. You just need to add whiever fields you need to "transfer" from the top to the bottom:
<script>
function transferInfo(o)
{
	if( o.checked)
	{
		var f = o.form;
		f.CardStreet.value = f.Address1.value;
		f.CardCity.value = f.AddressCity.value;
		
	}
}
</script>

Open in new window

0
 
LVL 82

Expert Comment

by:hielo
ID: 22908974
BTW, the checkbox would be:
<input type="checkbox" name="billing" value="sameaspersonal" onclick="transferInfo(this)"/>Same as personal info

Open in new window

0
 
LVL 82

Expert Comment

by:hielo
ID: 22966152
glad to help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

850 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