goo
goo

Reputation: 2280

Simple Client Side Validations in Rails

Basically, I have 10 validations on a form in my Rails app. If there are errors, the page refreshes & shows the errors in a box.

How can I show the error box without refreshing? I would like the box to display after clicking submit.

I saw a railscasts episode on client side validations using a gem but it seemed a bit too much & complicated for what I'm going after, plus I couldn't get it working. Looking through some of SO's similar questions, I know I'll have to use jquery/java but I'm still sort of lost. Could someone point me in the right direction

Thank you in advance.

Upvotes: 2

Views: 2717

Answers (3)

sunil
sunil

Reputation: 1040

You can Check Here.. Very good documentation..

https://sunilsharma3639.wordpress.com/2013/11/11/jquery-ketchup-plugin-for-client-side-form-validation/

Upvotes: 1

jbmyid
jbmyid

Reputation: 2015

You can try https://github.com/jbmyid/rails_jq_validations

This is too simple to use.

Upvotes: 1

zeantsoi
zeantsoi

Reputation: 26193

You may want to consider either rolling your own client-side solution, or using a Javascript/jQuery library.

Personally, I've had a lot of luck with jQuery.validationEngine. It enables configurable and extensible form validations which work well out-of-the-box:

enter image description here

And while I haven't tried it myself, jquery-validation seem to be another popular client side validation library.

There are surely many other libraries out there for doing what you're looking to accomplish, but I'm fairly confident there's a good reason why these two are among the most popular solution. Additionally, both are well-documented and lay out concise instructions for simple implementations on their respective GitHub pages.

Upvotes: 2

Related Questions