LiveValidation is a small open source javascript library for making client-side validation quick, easy, and powerful. livevalidation plugin is used to integrate Javascript library LiveValidation to the Rails application. LiveValidation implements client-side form validation. To see livevalidation in action ( !!! ) we have to install it in our rails project. Then use Rails validation helpers to validate our models and use Rails form helpers to create our forms.
here is the example steps how i make it live in my project. [i use Netbeans 6.0 to build my app]
1. create a new project
2. run Rake Task to create the db
3. generate scaffold with this parameter in the [Model Name:] text field
Blog title:string body:text4. now, download livevalidation plugin from github
5. unzip the downloaded zip folder and rename the folder 'livevalidation'
6. store 'livevalidation' folder in the "\vendor\plugins\" folder. [i.e. \vendor\plugins\livevalidation]
7. now install Javascript and CSS with this Rake task
$ rake livevalidation:install
8. add these lines in /views/layout/blogs.html.erb
<%= javascript_include_tag :defaults, 'live_validation' %>9. now add validations to the model
<%= stylesheet_link_tag 'live_validation' %>
validates_presence_of :title10. now start the server and go to http://localhost:3000/blogs/new
11. when you leave title textfield without entering any value, you will get an error in RED and when you type something in that field you will get a thnx :) . so its working
This entry was posted
on Sunday, February 15, 2009
and is filed under
live validation,
Ruby on Rails
.
You can leave a response
and follow any responses to this entry through the
Subscribe to:
Post Comments (Atom)
.
1 comments