Tuesday 3 December 2002 — This is nearly 22 years old. Be careful.
I was doing some online shopping, and had to enter a credit card number. I entered my credit card number (using virtual card numbers, of course). I hit submit, and was prompted to enter a valid credit card number. Of course, what had happened was that I had entered my number with spaces between every four digits, as any normal person would do, and the stupid site would only accept the number with no spaces in it.
Why is this so hard? How many people a day get that idiotic message box? Looking at the source for the page, I found these snippets of JavaScript:
var cardPattern = /\d{16}/;
if (!(cardPattern.test(document.userInfo.cardNumber.value))) {
errorMsg += 'Please enter a valid Card Number.\n';
errorFlg = 1;
}
Why not do this:
var cardPattern = /\d{16}|\d{4} \d{4} \d{4} \d{4}/
and let me be? Why after all these years are average users still expected to pick up the slack for lazy programmers?
And don’t tell me, “the back end wouldn’t accept the string with spaces, so the front end is right to reject it”! Why can’t the back end deal with the spaces?
Comments
Add a comment: