Required Field prompts

Parent Previous Next

Required Fields via Javascript Validation

This code will allow you to use Javascript to make fields required, rather than the source key settings. You may want to use this rather than the built-in required fields settings as an alternate way of requiring those fields to be filled out. The main difference between this and our built-in required fields handling is that this will ensure fields are filled out before the customer leaves the page - some web browsers will erase all data if the customer leaves the page.

  1. Log into your eBizCharge merchant gateway. Go to “Settings”, then “Source Keys”. Select the source key you are using and click “Edit”. Click “Edit Customization to Epay Form”.
  2. Insert this code into the document head:
    1. <script>

function verify()

{

var themessage = "Please complete the following fields: ";

if (document.epayform.UMname.value=="") {

themessage = themessage + " - Cardholder Name";

}

//alert if fields are empty and cancel form submit

if (themessage == "Please complete the following fields: ") {

document.epayform.submit();

return true;

}

else {

alert(themessage);

return false;

}

}

</script>

  1. You can make as many fields required as you want. To make a field required, repeat this section of code:
    1. if (document.epayform.UMfield.value=="") {

themessage = themessage + " - Name Of Field";

}

  1. Scroll down to the bottom of the form and look for this line:
    1. <input type="submit" name="submitbutton" value="Process Payment &gt;&gt;">
  2. Change it to read:
    1. <input type="submit" name="submitbutton" value="Process Payment &gt;&gt;" onclick="return verify();">

: