4 ms·
Form validation.
by GoToRO 9y ago
Form validation.
- obilgic 9y agoPlus dynamic fields, options
- krapp 9y agoForm validation doesn't need to be done in Javascript. I'd argue that it shouldn't ever be done in Javascript, because that means implicitly trusting the client, which is always a bad idea. Since any sane application revalidates the response on the server anyway, client side validation is just a gimmick, it's not necessary.
- Spivak 9y agoValidation on the client is to catch user mistakes, validation on the server is to catch malicious actors.
- dwaltrip 9y agoIt creates a better user experience. We create a worse user experience by waiting until the form is submitted to inform the user of some silly error. For some applications, the difference isn't that big, but for many it brings a significant improvement. Is it possible to create crappy client side validation? E.g. not letting the user temporarily input invalid data while filling out the form, or displaying over-the-top red error indicators everywhere as soon as a single mistake is made, etc... Definitely. But let's not throw the baby out with the bathwater. The backend should never trust the client, of course. That is a separate goal of the application, however.
- Kuraj 9y ago> I'd argue that it shouldn't ever be done in Javascript, because that means implicitly trusting the client, which is always a bad idea. It absolutely shouldn't be done in Javascript only.
- untog 9y ago> client side validation is just a gimmick Server side validation requires a whole page round trip. The user will have to wait, lose their scroll position... you can't rely on client side validation only, but neither is it a gimmick.
- studio_monolith 9y agoWhat is ajax
- Zecc 9y ago> What is ajax Server-side validation relying on JavaScript. You still have to wait for the server to respond, and now you need to implement UI to tell the user something is happening in the background. But at least you can start proactively validating before the user actually submits the form, so there's that.
- deleted 9y ago[deleted]
- linopolus 9y agoIn special cases, maybe. Basic validation (Email looks like email, number contains no text...) is done by the browser automatically if you use semantically correct <input> types: http://diveintohtml5.info/forms.html#validation http://diveintohtml5.info/forms.html#validation