Skip to content

creditcard validation throws error only on mobile Safari #1767

Open
@bradmurray

Description

@bradmurray

Versions:

  • jquery 2.2.3
  • jquery-validate version 1.15.0
  • mobile Safari on iOS 9.3 (confirmed on both iPhone 5 and iPhone 6s+

This code works fine on all other tested browsers (desktop and mobile) but in mobile Safari when calling the .validate for the page I receive:

[Error] TypeError: undefined is not an object (evaluating 'a.validator.methods[d].call').  Exception occurred when checking element txtCreditCardNumber, check the 'creditcard' method.
    check (jquery.validate.min.js:4:11271)
    element (jquery.validate.min.js:4:7203)
    onfocusout (jquery.validate.min.js:4:3486)
    b (jquery.validate.min.js:4:5194)
    dispatch (jquery-2.2.3.min.js:3:7543)
    handle (jquery-2.2.3.min.js:3:5626)
    trigger (jquery-2.2.3.min.js:4:4842)
    simulate (jquery-2.2.3.min.js:4:5262)
    c (jquery-2.2.3.min.js:4:6025)

the error is reported as coming from jquery.validate.min.js:276

The rule for this field is simply:

{ required: true, creditcard: true }

My current workaround is to change the rule to:

{ required: true, digits: true, minlength: 12, maxlength: 16 }

when I detect an iOS device. This seems to work but is not ideal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions