News for hackers. Stuff that matters.
Re:Htmx Is the Future by ZephyrBlu on Friday May 05, 2023 @04:10PM (#35834534)
Frontend and backend validation are usually not the same though. You won't be writing the same thing twice, you'll be writing different validations for each.
Re:Htmx Is the Future by emodendroket on Friday May 05, 2023 @05:47PM (#35835513)
I think the frontend validations will, most of the time, be a subset of the backend ones, with many shared validation points.
Re:Htmx Is the Future by iainmerrick on Friday May 05, 2023 @10:44PM (#35837459)
Yes, exactly!

I’ve several times been in the position of writing a new UI for an existing API. You find yourself wanting to validate stuff before the user hits “submit”, because hiding errors until after submitting is terrible UX; and to do that, you find yourself digging into the server code to figure out the validation logic, and duplicating it.

And then years or months later the code gets out of sync, and the client is enforcing all sorts of constraints that aren’t needed on the server any more! Not good.