News for hackers. Stuff that matters.
Re:HTML Tips (2020) by theandrewbailey on Wednesday May 05, 2021 @04:59PM (#27055747)
> Form validation should be built-in

Have you used pattern attributes?

https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes...

Re:HTML Tips (2020) by intergalplan on Thursday May 06, 2021 @10:32AM (#27063852)
Yes! That is definitely a big step in the right direction. It's usually enough to remove at least some of the JS burden on forms. I'm not sure how widespread its use is in practice, though.
Re:HTML Tips (2020) by wilsonrocks on Thursday May 06, 2021 @02:36AM (#27059863)
I know it uses JS but the customValidity stuff is pretty cool too!
Re:HTML Tips (2020) by edoceo on Wednesday May 05, 2021 @06:59PM (#27056930)
and the :invalid css option (I like to just make the bottom border red, dashed)
Re:HTML Tips (2020) by rafd on Friday May 07, 2021 @06:32AM (#27074384)
FYI now there’s also :user-invalid which waits for the user to blur out of the field before it indicates the validity.