No commit activity in last 3 years
No release in over 3 years
displays validation errors to fields on views
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0
 Project Readme

ServerSideValidation

This is simple ruby gem(https://rubygems.org/gems/server_side_validation) to show model validation on view for each form field.

Installation

Add this line to your application's Gemfile:

gem 'server_side_validation'

And then execute:

$ bundle

Or install it yourself as:

$ gem install server_side_validation

Usage

  1. To show model validation next to the form field make sure you should have a js request from form.

  2. use show_validation_errors method in controller action as

    if @object.save
        your code goes here ....
    else
        show_validation_errors(object)
    end
  1. In html.erb files, you need to write 'error' class for displaying error message next to the form field.

Also define 'field_name_txt' class for each of the field present on form.

<%= contact.text_area :message, class: 'form-control message_txt' %>
<div class ='error'></div>

This will show an validation error message inline next to your form fields.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/GaneshNavale/server_side_validation. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.