This topic explains how to configure Form Designer forms to use a JavaScript function to verify that users entered a credit card number in the correct format for the credit card type that they specified. This process does not authenticate the data entered by the user but does assist in the validation process by verifying the format.
Note: You can also use regular expressions to validate the format of credit card numbers and other kinds of commonly requested data, such as social security numbers, email addresses, phone numbers, and so forth.
This topic explains how to present two credit card types: Master Card and Visa. For each type, you create a radio group option and a text field for the account number. Each account number field is disabled by design but is enabled if the user selects the matching credit card type.
You use the pre-defined JavaScript function named ca_fdValidateCC(number, 'type') to validate the format of the credit card number entered by the user, based on the credit card type that the user selected. This JavaScript function verifies the format according to the specifications set by the company issuing the credit card. Each company sets its own standard format.
To verify the credit card numbers entered by users, follow these steps. These steps use a continuing example for illustration.
function cc_val(value) {
var ccname = '';
if (ca_fdIsSelectRadio('ccValdtnForm1', 'rgCCVal', 'mcard'))
ccname = 'master';
else
ccname = 'visa';
ca_fdValidateCC(value, ccname);
}
As a best practice, use the Script dialog on each form to create and maintain the custom JavaScript functions for the form.
As a best practice, verify that you test the form in a service in a test environment before you use the form and the service in a production environment.
|
Copyright © 2013 CA.
All rights reserved.
|
|