How do you avoid duplication of validation on the server and client-side? Is there a web programming platform that generates one from the other, so I don't have to keep the two in sync?
While client-side validation is faster and favors user experience, it should not be used in isolation because client-side validation relies on the browser (which can be tricked). Client-side validation should always be used along with server-side validation as the latter is more reliable.
Your apps should always perform security checks on any form-submitted data on the server-side as well as the client-side, because client-side validation is too easy to bypass, so malicious users can still easily send bad data through to your server.
In the Server Side Validation, the input submitted by the user is being sent to the server and validated using one of server side scripting languages such as ASP.Net, PHP etc. After the validation process on the Server Side, the feedback is sent back to the client by a new dynamically generated web page.
The advantages to using client-side validation are two-fold users receive feedback quicker (no need to go off to the server, process the information, then download another HTML page), and also it saves load on the server - more work is done on the client side.
There are frameworks that can generate the client-side validation from serverside validation configuration.
Now I don't know what language or frameworks you are using, but maybe this article can be of help: http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/
He's using Castle Validator Component together with JQuery and adds some glue to generate the clientside validation based on the serverside validation attributes. It's for asp.net mvc.
/Asger
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With