Live data from Hacker News

HTML Form Validation is underused

expressionstatement.com

131–140 of 343 posts

Re: HTML Form Validation is underused

#131

My personal bête noire is sites that misuse type=password for 2FA inputs, since that confuses password managers and browsers both.

There is a way to annotate it. autocomplete=one-time-code https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes...

True, but vast majority of websites don't do the right thing. So password managers need to manage a database of form input overrides. I worked at a small company building a password manager and it was a bit of a nightmare, we had to allocate support staff resources to handling reports of website incompatibilities.

Re: HTML Form Validation is underused

#133
post #125
post #118

Earlier quoted context omitted.

On Android, the date picker widget is fiddly to use for selecting distant dates, like date of birth. Not impossible but requires many many taps.

That's an implementation issue, not a specification issue. The specification just suggests the user is shown a date picker.

You’re technically right but that doesn’t matter.

That you’re correctly using html forms won’t quickly lead to browser improvements.. so the result is that users will hate your forms. Users/your customer might possibly even think that you’re to blame, and not $browserVendor.

Re: HTML Form Validation is underused

#134

>Imagine a username input that should be valid only if the username is not taken Maybe that is user friendly but for sure I don't like to see the backend bombarded with API calls each time an user types a letter.

It's not actually all that bad, if you do it asynchronously and in batches (as much as possible).

The total amount of traffic in both direction is pretty small, and the logic is simple, especially compared to lots of other things your server is typically doing.

Re: HTML Form Validation is underused

#135
post #121

Earlier quoted context omitted.

I used to write those fancy textboxes that reformatted your input as a phone number as you type, and intercept paste, and all that. But then it turns out that you really do want a free-form text input. Let people paste text in, edit their text freely, then let it validate afterwards. When it validates, then reformat it. For example, text boxes with length limits. These are awful. It messes with your ability to paste…

Nah. Users are too stupid to fix their own inputs in many cases. Seen inputs with zero-width spaces that are invisible which fail validation. User doesn't understand why, complains. Enforcing a character set for certain kinds of inputs is a very good thing.

Why blame it on the user, instead of fixing it?

You could remove the zero-width spaces in validation (for eg a phone number).

Re: HTML Form Validation is underused

#136
post #135

Earlier quoted context omitted.

Nah. Users are too stupid to fix their own inputs in many cases. Seen inputs with zero-width spaces that are invisible which fail validation. User doesn't understand why, complains. Enforcing a character set for certain kinds of inputs is a very good thing.

Why blame it on the user, instead of fixing it? You could remove the zero-width spaces in validation (for eg a phone number).

Or, you know, prevent invalid characters from the get-go. Same thing as validation, but done up-front. (But as I said elsewhere, I'm not talking about phone numbers, I'm talking about amounts)

Re: HTML Form Validation is underused

#137

>Imagine a username input that should be valid only if the username is not taken Maybe that is user friendly but for sure I don't like to see the backend bombarded with API calls each time an user types a letter.

WebSockets, then it's a couple bytes a click

Re: HTML Form Validation is underused

#138
post #135

Earlier quoted context omitted.

Why blame it on the user, instead of fixing it? You could remove the zero-width spaces in validation (for eg a phone number).

Or, you know, prevent invalid characters from the get-go. Same thing as validation, but done up-front. (But as I said elsewhere, I'm not talking about phone numbers, I'm talking about amounts)

I would like to allow people to copy-and-paste text in, and then edit it. That could be a longer text that has the amount in it (but also some unrelated numbers).

Re: HTML Form Validation is underused

#139
post #11

The biggest, easiest to implement underutilization is: "Using specific type attribute values, such as "email", "number", or "url"" These can significantly improve user experience on mobile by triggering the optimal keyboard.

I found this very extended with "date" input. It seems that every single frontend library has its own date widgets, and lots of them look awful in small screens. You have to add a JS and CSS just for that widget, some depending on jQuery. True, some of them are very configurable, but with the tiny cost of "" you have a widget that looks decent and native everywhere, probably cover your needs, and you can forget about it forever (e.g. no updates, no CDN).

Re: HTML Form Validation is underused

#140
post #22

In an all honest reply, is that the people that writes these specifications, live disconnected from the reality, they don't use the stuff they specify. That stuff works for very simple things, but then when your forms evolve you realise you will be better off just writing the whole thing yourself.

Most of the forms features are from the early 90s. You're not working in the same millennium as some of the specification writers.
Post reply on HN