Instructions

Form Tips

Form Actions

Java Validation

Validation Sample

Contact Support

Multipart Secure Forms Hosting by SSNet, Inc.

Java Validation Example

Secure Payment Data

Credit Card Data

Card Number (1234 2345 1234 1234)
Expires
Cardholder's Name
(To whom is the card issued)

Name of Issuing Bank
(FirstCard, Chase, Amex, Discover)
Customer Service Phone Number
(Found on the back of your card)

3 or 4 Digit CVN Number
(What is that?)

To see exactly how this validation script works, simply click the "Submit" button. For every field you leave blank or enter the wrong data, you will be prompted to correct the mistake.

It may help you to view the actual source code of this page by using your browser's View - Source type function, although, all the critical elements are explained below:

This line of code is contained with the HEAD tags of this HTML page:

<HEAD>
<script language="JavaScript" src="gen_validatorv2.js" type="text/javascript"></script>
</HEAD>

The form is named payment by adding that to the form action line:

<FORM NAME="payment" ACTION="" METHOD="POST">

And the validation parameters are contained just below the closing </FORM> tag:

<script language="JavaScript" type="text/javascript">

var frmvalidator = new Validator("payment");
frmvalidator.addValidation("Credit_Card_Number","regexp=^[0-9 ]{15,19}$",
"Only numbers and spaces are allowed for a credit card number and the total for digits and spaces should be between 15 and 19 characters, better check that card number!");

frmvalidator.addValidation("Credit_Card_Expiration_Month","dontselect=0",
"Please select the credit card expiration Month!");

frmvalidator.addValidation("Credit_Card_Expiration_Month","dontselect=0",
"Please select the credit card expiration Year!");

frmvalidator.addValidation("Cardholder_Name","regexp=^[a-zA-Z\ \.\,]{3,50}$",
"Cardholder's Name is a required field. Only letters, spaces, periods and commas are allowed and it must be between 3 and 50 characters");

frmvalidator.addValidation("Issuing_Bank","regexp=^[0-9a-zA-Z\ \-\,\.]{3,40}$",
"The Name of the Issuing Bank is a required field. Only alphanumeric, the - and the , are allowed and it must be between 3 and 40 characters!");

frmvalidator.addValidation("Bank_Phone_Number","regexp=^[0-9 -().]{10,14}$",
"Bank Phone Number is a required field. Only numbers, spaces, dashes or ( ) are allowed and the total for digits and spaces should be between 10 and 14 characters, better check that phone number!");

frmvalidator.addValidation("CVN_Number","regexp=^[0-9]{3,4}$",
"Only 3 (Visa and non-AMEX) or 4 (AMEX) digits are allowed in the CVN number!");

</script>

All Material Copyright by SSNet, Inc.