Reputation: 2280
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
Reputation: 2015
You can try https://github.com/jbmyid/rails_jq_validations
This is too simple to use.
Upvotes: 1
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:
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