How to Add jQuery Validation in your Rails 5 Forms Without a Gem

Some kind of jQuery validation should be implemented on any Rails form. It’s not always straightforward, but your users need it. There is nothing worse than to fill in many fields, submit the form, waiting for the page to load and then be told that what you did was not right.

Think of your own interactions. How better is it when the form tells you what’s wrong right away? Thanks to Javascript, it’s possible to improve the user experience by telling the user what’s correct and what’s not at the same time as they are entering values. If you are not convinced about the need for UX improvements on basic forms, take a look at this article by Marcin Treder and this one by Luke Wroblewski (those are must read).

Ready to add some validation to your Rails forms? Good. Let’s see what options are available, before building a simple, straightforward and yet very efficient jQuery form validation.

UPDATE: Read the updated article on Codkal.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.