merchant:epaymentform:copyfield

Copying fields into a second field

This code will allow you to make a text box on your form that automatically duplicates it's input in a second field. For this example UMstreet is being copied into UMbillstreet so the avs street and billing street match. For other fields simply change “UMstreet” in the examples to the field you are copying and “UMbillstreet” to the field it is being copied into.

- Log into your USAePay merchant gateway. Go to “Settings”, then “Source Keys”. Select the source key you are using and click “Edit”. Click “Edit Customization to Epay Form”.

- Insert the following between <head> and </head> tags: -

<script>
function copyField()
{
var form = document.epayform;
form.UMbillstreet.value=form.UMstreet.value;
 form.UMbillzip.value=form.UMzip.value;
}
</script>

- Next find the hiden input fields. It should looks like this:

<input type="hidden" name="UMcommand" value="[UMcommand]">
<input type="hidden" name="UMamount" value="[UMamount]">
<input type="hidden" name="UMtax" value="[UMtax]">
<input type="hidden" name="UMinvoice" value="[UMinvoice]">
<input type="hidden" name="UMcustid" value="[UMcustid]">
<input type="hidden" name="UMrecurring" value="[UMrecurring]">
 

- Add a line for the field you are copying into. it should look like this:

<input type="hidden" name="UMbillstreet" value="">

- If the field you are copying into already has a textbox remove it by deleting the section that looks like this:

<tr>
 <td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Address:</font></td>
 <td bgcolor="#F0F0F0" width="450">
 <input type="text" name="UMbillstreet" size="25" value="[UMbillstreet]"></td>
</tr>

- Lastly find the text input box for the field you are copying from:

<tr>
 <td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Card Billing Address:
 </font></td>
 <td bgcolor="#F0F0F0" width="450">
 <input type="text" name="UMstreet" size="25" value="[UMstreet]"></td>
</tr> 

- Add onChange=“copyAVS()” to the input tag so it looks like this:

<tr>
 <td bgcolor="#F0F0F0" width="234" align="right"><font face="Verdana" size="2">Address:
 </font></td>
 <td bgcolor="#F0F0F0" width="450">
 <input type="text" name="UMstreet" size="25" value="" onChange="copyField()"></td>
</tr>

- Save the changes to your form.

merchant/epaymentform/copyfield.txt · Last modified: 2016/09/12 16:31 by charlie

Page Tools