6 ms·
This. You can't trust client-side validation anyway, so you need to have some server-side. So why not just let the page refresh, and then add a tiny bit of Java
by TeMPOraL 9y ago
This. You can't trust client-side validation anyway, so you need to have some server-side. So why not just let the page refresh, and then add a tiny bit of JavaScript that'll send off the form via AJAX to validation?
Suddenly, the site becomes solid, lightweight, and supports everyone. That's what I think people used to call "progressive enhancement".
- mrighele 9y agoI would love to have a way to tell the browser "don't throw away the current DOM, Just apply the differences". It would work nicely in non-js page to make the experience smooth (and would probably work terribly if there was a lot of J's, of course)
- nojvek 9y agoThis. Every major client lib out there uses some variant of vdom. If this dom diffing was natively supported, browser would request with current dom hash and server could efficiently reply with a diff that both server and client can compute to be the same new hash. If it's forms. Client calls server with base hash + changes made by client and server replies with. Base hash + new diff to apply. The new diff includes validation changes. It's trees and diffs all the way down.
- pcmaffey 9y agoThis is exactly what React's virtual DOM does. Maybe the future is making the virtual DOM native to the browser? Bundle React with Chrome? Or how about a browser package manager that could cache and reuse all these common js libraries used on so many sites?
- discreditable 9y agoDecentralEyes does just that.
- grogs 9y agoSounds like PJAX.
- nawitus 9y agoPage refresh takes a longer time than client-side validation.
- gjjrfcbugxbhf 9y agoBut you still need to do the server side valuation.
- christophilus 9y agoYes, but from the end-user perspective, it's nice to not have to do a round-trip to find out that you entered something wrong.
- TeMPOraL 9y agoFair enough. Still, validating a form client-side doesn't require a JavaScript framework; it would only require the server to send small snippets of JS for each field with the form.
- Can_Not 9y agoThat doesn't detract from the value of client side validation, which is that it will be faster from the client's perspective and reduce server load.