/    Sign up×
Community /Pin to ProfileBookmark

Trouble with Auto Fill of Shipping Info…

I’m trying to get my form to allow for the checkbox to be clicked to auotmatically fill in the shipping form with the same information the user just filled out in the billing form.

I’ve been looking at some examples and I can’t seem to figure out why mine isn’t working. Please take a look and let me know what you think. Any information you can give would be greatly appreciated.

Thanks!

<SCRIPT LANGUAGE=JAVASCRIPT>
function useBillInfo(woodOrderEntry)
{
var idx;

{
woodOrderForm.ShipFirstName.value = woodOrderForm.ContactFirstName.value;
woodOrderForm.ShipLastName.value = woodOrderForm.ContactLastName.value;
woodOrderForm.ShipCompany.value = woodOrderForm.CompanyName.value;
woodOrderForm.ShipFirstName.value = woodOrderForm.ContactFirstName.value;
woodOrderForm.ShipCompany.value = woodOrderForm.CompanyName.value;
woodOrderForm.ShipAddress.value = woodOrderForm.BillingAddress.value;
woodOrderForm.ShipAddress2.value = woodOrderForm.BillingAddress2.value;
woodOrderForm.ShipCity.value = woodOrderForm.City.value;
woodOrderForm.ShipStateOrProvince.value = woodOrderForm.StateOrProvince.value;
woodOrderForm.ShipPostalCode.value = woodOrderForm.PostalCode.value;
woodOrderForm.ShipCountry.value = woodOrderForm.CountryOrRegion.value;
woodOrderForm.ShipPhoneNumber.value = woodOrderForm.PhoneNumber.value;
woodOrderForm.ShipFaxNumber.value = woodOrderForm.FaxNumber.value;
woodOrderForm.ShipEmailAddress.value = woodOrderForm.EmailAddress.value;

}
}

</SCRIPT>

</head>

<body>
<form action=”” method=”post” name=”woodOrderEntry” id=”woodOrderEntry”>
<table border=”0″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td width=”10″ height=”37″ valign=”top”></td>
<td width=”356″ height=”37″ valign=”top”></td>
<td width=”20″ height=”37″ valign=”top”></td>
<td width=”149″ height=”37″ valign=”top”></td>
<td width=”149″ height=”37″ valign=”top”></td>
<td width=”58″ height=”37″ valign=”top”></td>
</tr>
<tr>
<td width=”10″ height=”492″ valign=”top”></td>
<td width=”356″ height=”492″ valign=”top”>
<table width=”100%” border=”0″ cellpadding=”2″ cellspacing=”2″ mm_noconvert=”TRUE”>
<tr>
<td colspan=”2″><div align=”center”><strong>Billing Information </strong></div></td>
</tr>
<tr>
<td width=”38%”><div align=”right”>First Name: </div></td>
<td width=”62%”><input name=”ContactFirstName” type=”text” id=”ContactFirstName” size=”25″ maxlength=”25″></td>
</tr>
<tr>
<td><div align=”right”>Last Name: </div></td>
<td><input name=”ContactLastName” type=”text” id=”ContactLastName” size=”25″ maxlength=”25″></td>
</tr>
<tr>
<td><div align=”right”>Company:</div></td>
<td><input name=”CompanyName” type=”text” id=”CompanyName” size=”25″ maxlength=”100″></td>
</tr>
<tr>
<td><div align=”right”>Street Address: </div></td>
<td><input name=”BillingAddress” type=”text” id=”BillingAddress” size=”25″ maxlength=”100″></td>
</tr>
<tr>
<td><div align=”right”>Street Address 2: </div></td>
<td><input name=”BillingAddress2″ type=”text” id=”BillingAddress2″ size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>City:</div></td>
<td><input name=”City” type=”text” id=”City” size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>State:</div></td>
<td><input name=”StateOrProvince” type=”text” id=”StateOrProvince” size=”8″ maxlength=”2″></td>
</tr>
<tr>
<td><div align=”right”>Postal Code: </div></td>
<td><input name=”PostalCode” type=”text” id=”PostalCode” size=”15″ maxlength=”15″></td>
</tr>
<tr>
<td><div align=”right”>Country/Region:</div></td>
<td><input name=”CountryOrRegion” type=”text” id=”CountryOrRegion” size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>Phone Number: </div></td>
<td><input name=”PhoneNumber” type=”text” id=”PhoneNumber” size=”25″ maxlength=”30″></td>
</tr>
<tr>
<td><div align=”right”>Fax Number: </div></td>
<td><input name=”FaxNumber” type=”text” id=”FaxNumber” size=”25″ maxlength=”30″></td>
</tr>
<tr>
<td><div align=”right”>Email Address:</div></td>
<td><input name=”EmailAddress” type=”text” id=”EmailAddress” size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>Notes:</div></td>
<td><textarea name=”Notes” cols=”25″ rows=”5″ id=”Notes”></textarea></td>
</tr>
</table>
</td>
<td width=”20″ height=”492″ valign=”top”></td>
<td width=”356″ height=”492″ colspan=”3″ valign=”top”>
<table width=”100%” border=”0″ cellpadding=”2″ cellspacing=”2″ mm_noconvert=”TRUE”>
<tr>
<td colspan=”2″><div align=”center”><strong>Shipping Information<br>
<INPUT onClick=”useBillInfo(this.woodOrderForm)” type=”checkbox” value=”1″ name=”ship_usebill”>
</strong>Use Billing Information <strong> <span class=”style1″><br>
</span></strong></div></td>
</tr>
<tr>
<td width=”38%”><div align=”right”>First Name: </div></td>
<td width=”62%”><input name=”ShipFirstName” type=”text” id=”ShipFirstName” size=”25″ maxlength=”25″></td>
</tr>
<tr>
<td><div align=”right”>Last Name: </div></td>
<td><input name=”ShipLastName” type=”text” id=”ShipLastName” size=”25″ maxlength=”25″></td>
</tr>
<tr>
<td><div align=”right”>Company:</div></td>
<td><input name=”ShipCompany” type=”text” id=”ShipCompany” size=”25″ maxlength=”100″></td>
</tr>
<tr>
<td><div align=”right”>Street Address: </div></td>
<td><input name=”ShipAddress” type=”text” id=”ShipAddress” size=”25″ maxlength=”100″></td>
</tr>
<tr>
<td><div align=”right”>Street Address 2: </div></td>
<td><input name=”ShipAddress2″ type=”text” id=”ShipAddress2″ size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>City:</div></td>
<td><input name=”ShipCity” type=”text” id=”ShipCity” size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>State:</div></td>
<td><input name=”ShipStateOrProvince” type=”text” id=”ShipStateOrProvince” size=”8″ maxlength=”2″></td>
</tr>
<tr>
<td><div align=”right”>Postal Code: </div></td>
<td><input name=”ShipPostalCode” type=”text” id=”ShipPostalCode” size=”15″ maxlength=”15″></td>
</tr>
<tr>
<td><div align=”right”>Country/Region:</div></td>
<td><input name=”ShipCountry” type=”text” id=”ShipCountry” size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>Phone Number: </div></td>
<td><input name=”ShipPhoneNumber” type=”text” id=”ShipPhoneNumber” size=”25″ maxlength=”30″></td>
</tr>
<tr>
<td><div align=”right”>Fax Number: </div></td>
<td><input name=”ShipFaxNumber” type=”text” id=”ShipFaxNumber” size=”25″ maxlength=”30″></td>
</tr>
<tr>
<td><div align=”right”>Email Address:</div></td>
<td><input name=”ShipEmailAddress” type=”text” id=”ShipEmailAddress” size=”25″ maxlength=”50″></td>
</tr>
<tr>
<td><div align=”right”>Notes:</div></td>
<td><textarea name=”OrderNotes” cols=”25″ rows=”5″ id=”OrderNotes”></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=”10″ height=”24″ valign=”top”></td>
<td width=”356″ height=”24″ valign=”top”></td>
<td width=”20″ height=”24″ valign=”top”></td>
<td width=”149″ height=”24″ valign=”top”></td>
<td width=”149″ height=”24″ valign=”top”>
<input type=”submit” name=”Submit” value=”Submit”>
<input type=”reset” name=”Reset” value=”Reset”>
</td>
<td width=”58″ height=”24″ valign=”top”></td>
</tr>
<tr>
<td width=”10″ height=”1″ valign=”top”><img src=”transparent.gif” alt=”” width=”10″ height=”1″></td>
<td width=”356″ height=”1″ valign=”top”><img src=”transparent.gif” alt=”” width=”356″ height=”1″></td>
<td width=”20″ height=”1″ valign=”top”><img src=”transparent.gif” alt=”” width=”20″ height=”1″></td>
<td width=”149″ height=”1″ valign=”top”><img src=”transparent.gif” alt=”” width=”149″ height=”1″></td>
<td width=”149″ height=”1″ valign=”top”><img src=”transparent.gif” alt=”” width=”149″ height=”1″></td>
<td width=”58″ height=”1″ valign=”top”><img src=”transparent.gif” alt=”” width=”58″ height=”1″></td>
</tr>
</table>

</form>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@UltimaterApr 06.2005 — [code=html]
<INPUT onClick="useBillInfo(this.form)" type="checkbox" name="ship_usebill">
[/code]

[code=html]
<SCRIPT LANGUAGE="javascript" type="text/javascript"><!--
function useBillInfo(woodOrderForm)
{
woodOrderForm.ShipFirstName.value = woodOrderForm.ContactFirstName.value;
woodOrderForm.ShipLastName.value = woodOrderForm.ContactLastName.value;
woodOrderForm.ShipCompany.value = woodOrderForm.CompanyName.value;
woodOrderForm.ShipFirstName.value = woodOrderForm.ContactFirstName.value;
woodOrderForm.ShipCompany.value = woodOrderForm.CompanyName.value;
woodOrderForm.ShipAddress.value = woodOrderForm.BillingAddress.value;
woodOrderForm.ShipAddress2.value = woodOrderForm.BillingAddress2.value;
woodOrderForm.ShipCity.value = woodOrderForm.City.value;
woodOrderForm.ShipStateOrProvince.value = woodOrderForm.StateOrProvince.value;
woodOrderForm.ShipPostalCode.value = woodOrderForm.PostalCode.value;
woodOrderForm.ShipCountry.value = woodOrderForm.CountryOrRegion.value;
woodOrderForm.ShipPhoneNumber.value = woodOrderForm.PhoneNumber.value;
woodOrderForm.ShipFaxNumber.value = woodOrderForm.FaxNumber.value;
woodOrderForm.ShipEmailAddress.value = woodOrderForm.EmailAddress.value;
}
//--></SCRIPT>
[/code]
×

Success!

Help @drewangell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...