Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AJAX Rails Validation

I have my form and validation working great with regular http requests. I would like it to use AJAX. I know i can validate on the client side but that seems redundant given that I have defined the validations in my model.

As the user is filling out the form, I'd like to give feedback to them on their entries. What is the best way to use the rails defined validations in an AJAX form and give live feedback?

like image 275
chrishomer Avatar asked Jul 20 '09 05:07

chrishomer


2 Answers

Check out the live-validations plugin. There's also an introductory screencast.

like image 67
Simone Carletti Avatar answered Sep 24 '22 23:09

Simone Carletti


For Rails 3 check out Client Side Validations: https://github.com/bcardarella/client_side_validations

Here's the railscast: http://railscasts.com/episodes/263-client-side-validations

like image 27
vansan Avatar answered Sep 24 '22 23:09

vansan