What is the right way of doing both client side and server side validation using jQuery and CodeIgniter? I am using the jQuery form plugin for form submit. I would like to use jQuery validation plugin (http://docs.jquery.com/Plugins/Validation) for client side validation and CodeIgniter form validation on the server side. However the two don’t seem to gel together (or I am unable to get my head around it). Can someone help please? Whether its a client side validation or server side validation, the user should see consistent UI displaying error messages next to the input fields.
[Edit] It appears that I can pass server side errors to showErrors() like here (http://forum.jquery.com/topic/jquery-validation-showerrors-error). However, if I am doing extra server-side validations (like checking if username is already taken) that aren’t present in the client-side rules, then the validation plugin clears these validation messages when user tabs out of these fields.
As mentioned these are two separate things.
Just build your client side validation in Jquery, if that passes, hand it over to your form controller and run validation / xss filtering there.
Try http://formigniter.org/ it’ll build your form (view), model, sql and controller with validation included in it. Easy peasy…
Hope this helps.