SlideShare a Scribd company logo
2
Most read
By Hoàng Đăng Khánh
Client Side Validations
Framgia Study Seminar
Using Client validation?
● Validation can occur as the form elements are completed and
before the form data is submitted to the server.
● Error recovery mechanism is quite simple as it guide the user
while filling up the form and ensures the user has filled the
required fields with valid data.
● A client-side input validation check can improve application
performance by catching malformed input on the client and,
therefore, saving a round-trip to the server.
Client validation gem
● I. Features
● II. Install
● III. Usage
●I. Features
● Automatically extract and apply validation rules defined
on the server to the client.
● Validate nested fields
● Support custom validations
● Work with any ActiveModel::Validations based model
● Client side validation callbacks
● Support custom validations
● …..
II. Install
gem 'client_side_validations'
● rails g client_side_validations:install
→ config/initializers/client_side_validations.rb
initializers/client_side_validations.rb
We need to add a validate: true option to the form_for
Custom Validators
● /app/models/user.rb
→ validates :email, email_format: true
● when the email field loses the focus
→/public/javascripts/rails.validations.custom.js
Refer
● http://railscasts.com/episodes/263-client-side-validations?view=
● https://github.com/bcardarella/client_side_validations/
Thank for listening

More Related Content

More from Framgia Vietnam (20)

PDF
Functional Programming With Elixir
Framgia Vietnam
 
PPTX
Dreamers defense
Framgia Vietnam
 
PDF
Timeless - Websocket on Rails
Framgia Vietnam
 
PPTX
Game Development with Pygame
Framgia Vietnam
 
PPTX
Racer Mice - Game Team
Framgia Vietnam
 
PDF
CSS3 Lovers, Gather Together
Framgia Vietnam
 
PDF
Java 8 new features
Framgia Vietnam
 
PPTX
Build public private cloud using openstack
Framgia Vietnam
 
PPT
Introduction to JRuby And JRuby on Rails
Framgia Vietnam
 
ODP
Some ways to DRY in Rails
Framgia Vietnam
 
PPTX
HTML5 DRAG AND DROP
Framgia Vietnam
 
PDF
Create 3D objects insite Cocos2d-x
Framgia Vietnam
 
PPTX
View, Store Procedure & Function and Trigger in MySQL - Thaipt
Framgia Vietnam
 
PPTX
Organize directories for applications with front-end and back-end with yii - ...
Framgia Vietnam
 
ODP
What is new in PHP 5.5 - HuyenNT
Framgia Vietnam
 
PPTX
An idea - NghiaLV
Framgia Vietnam
 
ODP
Audited activerecord - QuanHV
Framgia Vietnam
 
PPT
Delegate - KhanhLD
Framgia Vietnam
 
PPT
Backbone.js and rails - BanLV
Framgia Vietnam
 
ODP
Jenkins and rails app - Le Dinh Vu
Framgia Vietnam
 
Functional Programming With Elixir
Framgia Vietnam
 
Dreamers defense
Framgia Vietnam
 
Timeless - Websocket on Rails
Framgia Vietnam
 
Game Development with Pygame
Framgia Vietnam
 
Racer Mice - Game Team
Framgia Vietnam
 
CSS3 Lovers, Gather Together
Framgia Vietnam
 
Java 8 new features
Framgia Vietnam
 
Build public private cloud using openstack
Framgia Vietnam
 
Introduction to JRuby And JRuby on Rails
Framgia Vietnam
 
Some ways to DRY in Rails
Framgia Vietnam
 
HTML5 DRAG AND DROP
Framgia Vietnam
 
Create 3D objects insite Cocos2d-x
Framgia Vietnam
 
View, Store Procedure & Function and Trigger in MySQL - Thaipt
Framgia Vietnam
 
Organize directories for applications with front-end and back-end with yii - ...
Framgia Vietnam
 
What is new in PHP 5.5 - HuyenNT
Framgia Vietnam
 
An idea - NghiaLV
Framgia Vietnam
 
Audited activerecord - QuanHV
Framgia Vietnam
 
Delegate - KhanhLD
Framgia Vietnam
 
Backbone.js and rails - BanLV
Framgia Vietnam
 
Jenkins and rails app - Le Dinh Vu
Framgia Vietnam
 

Recently uploaded (20)

PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Complete Network Protection with Real-Time Security
L4RGINDIA
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Complete Network Protection with Real-Time Security
L4RGINDIA
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Ad

Client side validations gem - KhanhHD