4 ms·
> I want to say that things like form validation are faster and easier now, but no I’d actually say forms are more of a pain in an SPA than they are with serve
by deergomoo 6y ago
> I want to say that things like form validation are faster and easier now, but no
I’d actually say forms are more of a pain in an SPA than they are with server rendering.
You have to track the state of every field so input doesn’t get clobbered on a re-render, which isn’t difficult but can be pretty tedious, especially if it’s a very dynamic form. And if you want native input attributes like `required` to work you need to still do a native form submission, but then intercept it and do your AJAX request or whatever instead.
The only part that’s really easier is handling server-side validation errors, because instead of trying to re-construct the populated form using the submitted input, you can just leave it all on screen.