PolymerElements/gold-cc-input

Name: gold-cc-input

Owner: PolymerElements

Description: An input element that only allows credit card numbers

Created: 2015-05-05 18:36:31.0

Updated: 2018-04-30 05:17:14.0

Pushed: 2018-05-23 02:25:32.0

Homepage: https://elements.polymer-project.org/elements/gold-cc-input?view=demo:demo/index.html

Size: 138

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build status Demo and API Docs

<gold-cc-input>

gold-cc-input is a single-line text field with Material Design styling for entering a credit card number. As the user types, the number will be formatted by adding a space every 4 digits.

d-cc-input></gold-cc-input>

It may include an optional label, which by default is “Card number”.

d-cc-input label="CC"></gold-cc-input>
Validation

The input can detect whether a credit card number is valid, and the type of credit card it is, using the Luhn checksum. See http://jquerycreditcardvalidator.com/ for more information.

The input can be automatically validated as the user is typing by using the auto-validate and required attributes. For manual validation, the element also has a validate() method, which returns the validity of the input as well sets any appropriate error messages and styles.

A list of allowable credit card types can be provided via the cardTypes property. Possible options, from cc-validator.js, are: amex, diners_club, discover, jcb, laser, maestro, mastercard, visa, visa_electron.

See Polymer.PaperInputBehavior for more API docs.

Styling

See Polymer.PaperInputContainer for a list of custom properties used to style this element.

| Custom property | Description | Default | | — | — | — | | ----gold-cc-input-icon-container | Mixin applied to the icon container | {} |


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.