Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, seriously. The expiry date field fails as well.

>Note that the placeholder text includes a “/”, but this is not required to be typed by the user. We limit the input value to numbers only, so if a user does type a forward slash, it is not registered.

Frankly, I'd prefer that field to be split into two, but I'd be fine with a single field, if they didn't ignore slash. It's pretty annoying to see a form silently fail and ignore characters that the form itself seemingly required (by showing them in the placeholder). A cluster of numbers like 0515 for date is not very intuitive either.

In my opinion much better way is to allow characters like spaces, dashes and slashes, show them when they are typed, but strip them on validation and further operations, working with only numbers.



The "/" is automatically added after you type the month, so you're never left with "0515". Try out the demo [1] and it should be a bit clearer.

[1] https://s3.amazonaws.com/gabe-cc-form/index.html


Ah, I didn't notice the demo. That is actually pretty nice. If only they would do the same with the credit card number field and spaces.

Edit: okay seems like it is more thought out than I assumed.


They do exactly that! However it depends on the type of card, so if you just start typing '1234567' it is not a valid card number and is unformtted. Try entering something that starts '42' (for a Visa debit card) and it will be formatted as such, in four groups of four digits. They also recognise AMEX cards and format appropriately, try '345612346712348' for example.


They do, but only when the number you're entering is recognised as one of the expected formats. If you type 1234, you'll see the space being added, but it's then stripped again with the next digit you input. If you hold down 4 or type 3 then hold down 4, the spaces will be added.

Things get fun if you try to go back and edit the number, though. Forms are hell :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: