Hacker News new | past | comments | ask | show | jobs | submit login
Stop building client-side forms (vararu.org)
10 points by tvararu on May 25, 2020 | hide | past | favorite | 2 comments



It’s probably worth adding a sentence or two to describe when client side forms are useful?

Once your form becomes very dynamic (“add another”, conditional fields/choices, 15+ change events), a server side form will end up needing to duplicate a lot of form rendering logic on both the front-end and the back-end. The server side template will need to be able to re-render the form on initial load, when fields are changed, and when the form is submitted with errors. The front-end will need all the logic to render form fields to avoid reloading the page constantly.

A mostly client side form doesn’t need to duplicate the form rendering logic in server side templates or make a request to the server side to re-render the form based on a choice you selected. I think this can be simpler and provide a better user experience for really complicated dynamic forms.

It’s a complicated decision that should be based on how dynamic your form is and how acceptable page refreshes are. Like a lot of things in our industry... I wish this post showed more nuance rather than bashing a solution that may be better in some scenarios.


There's one important detail you forgot: server-side forms make caching more difficult. It can be a performance bottleneck.

As already pointed out, dynamic parts require client-side logic.

There's also quite a bit of FUD going on in that article. You can write a client-side form without loading 200kb of libraries. I write mine in vanilla JS. It really isn't that hard.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: