Opened 15 years ago
Closed 15 years ago
#2694 closed bug (fixed)
[validate] creditcard validates true if alpa characters are used
Reported by: | jforth | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.4 |
Component: | plugin | Version: | 1.2.3 |
Keywords: | validate creditcard | Cc: | |
Blocked by: | Blocking: |
Description
creditcard rule validates true if alpa characters are used
example: asdf validates true.
Change History (3)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
creditcard: function(value, element) { if(/[^0-9-]+/.test(value)) return 0; if ( this.optional(element) ) return "dependency-mismatch"; var nCheck = 0, nDigit = 0, bEven = false; value = value.replace(/\D/g, ""); for (n = value.length - 1; n >= 0; n--) { var cDigit = value.charAt(n); var nDigit = parseInt(cDigit, 10); if (bEven) { if ((nDigit *= 2) > 9) nDigit -= 9; } nCheck += nDigit; bEven = !bEven; } return (nCheck % 10) == 0; }
Note: See
TracTickets for help on using
tickets.
fix? maybe