Client Side Validations
Upcoming SlideShare
Loading in...5
×
 

Client Side Validations

on

  • 2,299 views

Rails 3 Client Side Validations gem

Rails 3 Client Side Validations gem

Statistics

Views

Total Views
2,299
Views on SlideShare
2,299
Embed Views
0

Actions

Likes
1
Downloads
18
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • When compared to our control version, the inline validation form with the best performance (after validation) showed compelling improvements across all the data we measured. Specifically, we saw:\na 22% increase in success rates,\na 22% decrease in errors made,\na 31% increase in satisfaction rating,\na 42% decrease in completion times, and\na 47% decrease in the number of eye fixations.\n\n
  • \n
  • \n
  • \n
  • \n
  • Does not support i18n\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Client Side Validations Client Side Validations Presentation Transcript

  • Client Side Validations Brian Cardarella @bcardarella http://bcardarella.com
  • Problems...Extracted code, a real mess to maintainSupporting both Rails 2 & 3 is hardNo nested attributesInconsistent validation modeletc...
  • RewriteClient side validation best practicesNested attributesSer ver side fallbackValidation message rendering consistencyCustom validatorsCustom FormBuildersInternationalized messagesRails 3 onlyjQuery only
  • Installinclude in your Gemfilerun ‘rails g client_side_validations:install’include ‘rails.validations.js’ in your layoutif you’re not using a custom FormBuilder (i.e.Formtastic or SimpleForm) uncomment thefield_error_proc in the initializer
  • ZOMG LIVE CODING!
  • Supported ValidatorsAll Rails 3 ValidatorsConditionals fallback to ser ver (:if, :unless)State taken into account (:create, :update)
  • Custom ValidatorsProperly write a Rails 3 Validator
  • How most do it...http://railscasts.com/episodes/211-validations-in-rails-3
  • The better way
  • Remote Validators
  • ZOMG Moar Live Coding!
  • CallbacksclientSideValidations.callbacks.element.after(element, eventData)clientSideValidations.callbacks.element.before(element, eventData)clientSideValidations.callbacks.element.fail(element, message, callback, eventData)clientSideValidations.callbacks.element.pass(element, callback, eventData)clientSideValidations.callbacks.form.after(form, eventData)clientSideValidations.callbacks.form.before(form, eventData)clientSideValidations.callbacks.form.fail(form, eventData)clientSideValidations.callbacks.form.pass(form, eventData)
  • Use Case: Gemcutter
  • Use Case: jQuery Mobile
  • Use Case: Multi-step form
  • Filter Validators
  • Rails 3.1Engines - Assets ser ved via Sprockets
  • Client Side Validations Brian Cardarella @bcardarella http://bcardarella.com https://github.com/bcardarellahttps://github.com/bcardarella/client_side_validations