Class: SC.Validator.CreditCard
Extends
SC.Validator.
Validate a field value as a credit card number.
This validator will perform a basic check to ensure the credit card number is mathematically valid. It will also accept numbers with spaces, dashes or other punctuation.
Converted credit card numbers are broken into units of 4.
Basic credit card validation courtesy David Leppek (https://www.azcode.com/Mod10)
Defined in: credit_card.js
- Since:
- SproutCore 1.0
Field Summary
- Fields borrowed from SC.Object:
- concatenatedProperties, isDestroyed, isObject, nextProperty, object, property, target, toInvalidate
- Fields borrowed from SC.Observable:
- isObservable
Instance Methods
- checkNumber(ccNumb)
- fieldValueForObject(object, form, field)
- objectForFieldValue(value, form, field)
- validate(form, field)
- validateError(form, field)
- validateKeyDown(form, field, charStr)
Instance Method Detail
checkNumber(ccNumb)
- Parameters:
- ccNumb
fieldValueForObject(object, form, field)
Expects a string of 16 digits. Will split into groups of 4 for display.
- Parameters:
- object
- form
- field
objectForFieldValue(value, form, field)
Removes all whitespace or dashes to make a single string.
- Parameters:
- value
- form
- field
validate(form, field)
- Parameters:
- form
- field
validateError(form, field)
- Parameters:
- form
- field
validateKeyDown(form, field, charStr)
Allow only numbers, dashes, and spaces
- Parameters:
- form
- field
- charStr
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)