Performing both client side and server side validation using jQuery and CodeIgniter Performing both client side and server side validation using jQuery and CodeIgniter codeigniter codeigniter

Performing both client side and server side validation using jQuery and CodeIgniter


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.


What is unclear? Each method will be distinct.

At a high level, essentially you will use the client-side validation before submitting your form data. If the client side checks pass, then submit the form and run your validation server-side. If the server-side validation fails then it should print an error when the page is re-rendered, and likewise if the validation/save succeeds.


Is it that you don't want to duplicate your server side validation rules and messages in your client side validation? This isn't supported in the core CodeIgniter framework.

I took a look around on the CodeIgniter wiki and someone has written a library to generate javascript from server side validation rules. I haven't tried it. But it might be what you are looking for.