News for hackers. Stuff that matters.
Re:Show HN: Remult – a CRUD framework for full-stack TypeScript by robocat on Monday May 23, 2022 @03:13AM (#31476137)
Exceptions are imperative, but validation should be declarative (only requires pure functions to work out validation state given stateful input parameters).

Exceptions are a really bad match for marking validation (even ignoring the arsefest that is debugging exceptions during keyboard input events - ugggh).

The DOM has onInvalid events[1] that are fired on form submit (not blur), and there is an :invalid[2] pseudo class for highlighting input errors. Not a perfect API, but certainly relevantly interesting.

[1] https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputEl...

[2] https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid

There are no comments on this comment yet.