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

If you were to type

W111AA

One letter at a time, auto-inserting the space

W / W1 / W11 / W11 1 / W11 1A / W11 1AA

But for W1, you'd do

W / W1 / W11 / W1 1A / W1 1AA

Which would be jarring - you don't know when the inward code ends without typing a space, so you have to infer.

That said there's no reason not to allow [a-zA-Z0-9 ] and format after typing is finished (onBlur or even after submission).

(Poorly implemented address validation in the UK was behind the change in BFPO addresses 10 years ago -- https://fetchify.com/latest-news/lets-talk-about-bfpo-addres...)



Auto-inserting while typing is not a good option, IMO, for the reason you mention, and I tend not to like forms that do this sort of thing.

Let the user type in the postcode and when they submit you can parse it as a whole maybe just in the backend, insert the space and display with the space from then on. Simple.




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

Search: