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

Yes?

You want to validate on the client side because it reduces latency and improves responsiveness.

You want to validate on the server side because you cannot trust the fucking client.



The point I'm contesting is that it's more difficult to validate on the server using HTMX.

And I'm not saying you should be only validating on submit when using HTMX.

Client exclusive validation is quite limited. Very often you need a trip to the server anyway so I don't buy the latency argument.

Plus in most cases showing error messages too fast is terrible UX. The only exception I can think of is when checking the validity of a password.


> Plus in most cases showing error messages too fast is terrible UX.

The solution to that problem is to debounce or throttle your error messages. That allows you to report validation issues to the user quickly, but not overwhelmingly fast, before sending a network request potentially across the Earth and back.


Showing error messages on the client side is not too fast or bad UX. Let's say someone entered an invalid credit card. Or an invalid email. Why even let that touch the backend?

Note that frontend forms libraries allow a lot of choice over when to show error messages.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: