News for hackers. Stuff that matters.
Re:HTML Form Validation is heavily underused by onion2k on Tuesday October 29, 2024 @03:03AM (#41980173)
In 26 years of web dev, mostly as a frontend person, I've only seen zero width spaces in three situations

- pasting from Word

- QA testers being through

- devs pranking each other

The third one is by far the most common. Word is much better these days and I've not seen that happen in a long time. I wish I saw QA test this stuff more often. The idea that it's common enough that you'd break your UX to handle it baffling to me.

Re:HTML Form Validation is heavily underused by francislavoie on Tuesday October 29, 2024 @03:08AM (#41980211)
"Break your UX" is a vast exaggeration. I'm not talking about phone number fields, to be clear. I'm talking about like numeric amounts, with maybe a negative or decimal point. It's literally just [0-9\.-] but that still requires JS to limit inputs to that.
Re:HTML Form Validation is heavily underused by HappMacDonald on Tuesday October 29, 2024 @07:54AM (#41982943)
What's wrong with

<input type="text" pattern="[0-9.-]*">

though?

Re:HTML Form Validation is heavily underused by francislavoie on Tuesday October 29, 2024 @08:15AM (#41983092)
It doesn't prevent the bad input, it only validates it on submission.
Re:HTML Form Validation is heavily underused by jcelerier on Tuesday October 29, 2024 @05:27AM (#41981327)
I see weird spaces every time I copy-paste from some pdf pretty much, especially if it's a digitised or 10+ years one. Hardly an irrelevant use case
Re:HTML Form Validation is heavily underused by lomase on Tuesday October 29, 2024 @06:19AM (#41982058)
Add to that pasting from MS Teams.
Re:HTML Form Validation is heavily underused by ragnese on Tuesday October 29, 2024 @07:54AM (#41982940)
I'll be one of those guys. I see the invisible whitespace from pasting ALL the time. I've literally dealt with user complaints caused by it three times in the last two weeks! (Usually customer issues don't make it to me unless our support team can't figure it out or suspects a bug)

To be fair, it's not usually that frequent. Just a funny coincidence that I've JUST dealt with it more recently.

Re:HTML Form Validation is heavily underused by 71bw on Wednesday October 30, 2024 @04:00AM (#41992772)
Try copying any string from any e-mail.