jessepollak / card

:credit_card: make your credit card form better in one line of code
MIT License
11.67k stars 1.47k forks source link

Always get validate error #360

Open AlanGio opened 7 years ago

AlanGio commented 7 years ago

Hello!,

I have always the same error when I user the form:

image

Uncaught TypeError: Cannot read property 'validateCardNumber' of undefined or Uncaught TypeError: Cannot read property 'validateCardCVC' of undefined depends input im using.

I included jquery.card and this is how Im initializating the script:

$('form').card({
    container: '.card-wrapper', // *required*
    debug: false // optional - default false
});

Many thanks for read! :)

AlanGio commented 7 years ago

Fixed!. sorry.

zubizarreta commented 7 years ago

How did you solve it. I'm getting the same error

murilohns commented 5 years ago

I'm getting this erros every time too, anyone can help me?

Only the nameInput is working, as you can see in the image below image

Here's my code:

card = new Card({
    form: document.querySelector('#co-payment-form'),
    container: '.card-wrapper',
    formSelectors: {
        numberInput: 'input[id="pagarme_creditcard_creditcard_number"',
        expiryInput: 'input[id="pagarme_creditcard_creditcard_expiration_date"',
        cvcInput: 'input[id="pagarme_creditcard_creditcard_cvv"',
        nameInput: 'input[id="pagarme_creditcard_creditcard_owner"'
    },

    masks: {
        cardNumber: false
    },

    placeholders: {
        number: '**** **** **** ****',
        name: 'Nome do Portador',
        expiry: 'MM/YY',
        cvc: '***'
    },
    formatting: false,
    debug: true
});

I've already tried with other selector too and only nameInput worked

formSelectors: {
    numberInput: 'input#pagarme_creditcard_creditcard_number',
    expiryInput: 'input#pagarme_creditcard_creditcard_expiration_date',
    cvcInput: 'input#pagarme_creditcard_creditcard_cvv',
    nameInput: 'input#pagarme_creditcard_creditcard_owner'
},

@AlanGio @jessepollak @zubizarreta